Models
Pydantic models for OpenAIRE API entities and responses.
DataSourceResponse = ApiResponse[DataSource]
module-attribute
Type alias for an API response containing a list of DataSource
entities.
OrganizationResponse = ApiResponse[Organization]
module-attribute
Type alias for an API response containing a list of Organization
entities.
ProjectResponse = ApiResponse[Project]
module-attribute
Type alias for an API response containing a list of Project
entities.
ResearchProductResponse = ApiResponse[ResearchProduct]
module-attribute
Type alias for an API response containing a list of ResearchProduct
entities.
ApiResponse
Bases: BaseModel
Generic Pydantic model for standard OpenAIRE API list responses.
This model represents the common envelope structure for API responses that
return a list of entities. It includes a header
(metadata) and a results
field containing the list of entities. It is generic over EntityType
to
allow specific entity types to be used in the results
list.
Attributes:
Name | Type | Description |
---|---|---|
header |
Header
|
A |
results |
list[EntityType] | None
|
An optional list of entities of type |
Source code in src/aireloom/models/base.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
handle_null_results(v)
classmethod
Ensure 'results' is a list or None.
Handles potential None or unexpected formats from the API. Logs a warning and returns an empty list for unexpected types.
Source code in src/aireloom/models/base.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
BaseEntity
Bases: BaseModel
A base Pydantic model for OpenAIRE entities (e.g., publication, project).
This model provides a common foundation for all specific entity types,
primarily by ensuring an id
field is present, which is a common
identifier across most OpenAIRE entities. It allows extra fields from the
API to be captured without causing validation errors.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The unique identifier for the entity. |
Source code in src/aireloom/models/base.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
ControlledField
Bases: BaseModel
Represents a field with a controlled vocabulary, typically including a scheme and a value.
This model is used for structured data elements where the value has a specific meaning defined by an associated scheme (e.g., a PID like DOI, or a subject classification from a specific thesaurus).
Attributes:
Name | Type | Description |
---|---|---|
scheme |
str | None
|
The scheme or system defining the context of the value (e.g., "doi", "orcid", "mesh"). |
value |
str | None
|
The actual value from the controlled vocabulary. |
Source code in src/aireloom/models/data_source.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
Country
Bases: BaseModel
Represents the country associated with an organization.
Attributes:
Name | Type | Description |
---|---|---|
code |
str | None
|
The ISO 3166-1 alpha-2 country code (e.g., "GR", "US"). |
label |
str | None
|
The human-readable name of the country (e.g., "Greece"). |
Source code in src/aireloom/models/organization.py
16 17 18 19 20 21 22 23 24 25 26 27 |
|
DataSource
Bases: BaseEntity
Model representing an OpenAIRE Data Source entity.
A data source in OpenAIRE can be a repository, journal, aggregator, etc. This model captures various metadata fields associated with a data source.
Source code in src/aireloom/models/data_source.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
Funding
Bases: BaseModel
Represents funding information for a project, including the source and stream.
Attributes:
Name | Type | Description |
---|---|---|
fundingStream |
FundingStream | None
|
A |
jurisdiction |
str | None
|
The jurisdiction associated with the funding (e.g., country code). |
name |
str | None
|
The name of the funding body or organization. |
shortName |
str | None
|
An optional short name or acronym for the funding body. |
Source code in src/aireloom/models/project.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
FundingStream
Bases: BaseModel
Represents details about a specific funding stream for a project.
Attributes:
Name | Type | Description |
---|---|---|
description |
str | None
|
A description of the funding stream. |
id |
str | None
|
The unique identifier of the funding stream. |
Source code in src/aireloom/models/project.py
18 19 20 21 22 23 24 25 26 27 28 |
|
Grant
Bases: BaseModel
Represents details about the grant amounts associated with a project.
Attributes:
Name | Type | Description |
---|---|---|
currency |
str | None
|
The currency code for the amounts (e.g., "EUR", "USD"). |
fundedAmount |
float | None
|
The amount of funding awarded. |
totalCost |
float | None
|
The total cost of the project. |
Source code in src/aireloom/models/project.py
48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
H2020Programme
Bases: BaseModel
Represents details about an H2020 programme related to a project.
Attributes:
Name | Type | Description |
---|---|---|
code |
str | None
|
The code of the H2020 programme. |
description |
str | None
|
A description of the H2020 programme. |
Source code in src/aireloom/models/project.py
63 64 65 66 67 68 69 70 71 72 73 |
|
Header
Bases: BaseModel
Represents the 'header' section commonly found in OpenAIRE API responses.
This model captures metadata about the API response, such as status,
query time, total number of results found (numFound
), pagination details
like nextCursor
, and page size. It includes validators to coerce
numeric fields that might be returned as strings by the API.
Attributes:
Name | Type | Description |
---|---|---|
status |
str | None
|
Optional status message from the API. |
code |
str | None
|
Optional status code from the API. |
message |
str | None
|
Optional descriptive message from the API. |
queryTime |
int | None
|
Time taken by the API to process the query, in milliseconds. |
numFound |
int | None
|
Total number of results found matching the query criteria. |
nextCursor |
str | HttpUrl | None
|
The cursor string to use for fetching the next page of results. Can be a string or an HttpUrl. |
pageSize |
int | None
|
The number of results included in the current page. |
Source code in src/aireloom/models/base.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
coerce_str_to_int(v)
classmethod
Coerce string representations of numbers to integers, logging on failure.
Source code in src/aireloom/models/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
Organization
Bases: BaseEntity
Model representing an OpenAIRE Organization entity.
Captures details about an organization, including its names, website,
country, and various persistent identifiers. Inherits the id
field
from BaseEntity
.
Attributes:
Name | Type | Description |
---|---|---|
legalShortName |
str | None
|
The official short name or acronym of the organization. |
legalName |
str | None
|
The full official legal name of the organization. |
alternativeNames |
list[str] | None
|
A list of other known names for the organization. |
websiteUrl |
str | None
|
The URL of the organization's official website. |
country |
Country | None
|
A |
pids |
list[OrganizationPid] | None
|
A list of |
Source code in src/aireloom/models/organization.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
OrganizationPid
Bases: BaseModel
Represents a persistent identifier (PID) for an organization.
Attributes:
Name | Type | Description |
---|---|---|
scheme |
str | None
|
The scheme of the PID (e.g., "ror", "grid", "isni"). |
value |
str | None
|
The value of the PID. |
Source code in src/aireloom/models/organization.py
30 31 32 33 34 35 36 37 38 39 40 41 |
|
Project
Bases: BaseEntity
Model representing an OpenAIRE Project entity.
Captures comprehensive information about a research project, including its
identifiers, title, funding, duration, and related metadata. Inherits the
id
field from BaseEntity
.
Attributes:
Name | Type | Description |
---|---|---|
code |
str | None
|
The project code or grant number. |
acronym |
str | None
|
The acronym of the project. |
title |
str | None
|
The official title of the project. |
callIdentifier |
str | None
|
Identifier for the funding call. |
fundings |
list[Funding] | None
|
A list of |
granted |
Grant | None
|
A |
h2020Programmes |
list[H2020Programme] | None
|
A list of |
keywords |
list[str] | str | None
|
A list of keywords or a single string of keywords describing the project. A validator attempts to parse comma or semicolon-separated strings. |
openAccessMandateForDataset |
bool | None
|
Boolean indicating if there's an open access mandate for datasets produced by the project. |
openAccessMandateForPublications |
bool | None
|
Boolean indicating if there's an open access mandate for publications from the project. |
startDate |
str | None
|
The start date of the project (typically "YYYY-MM-DD" string). |
endDate |
str | None
|
The end date of the project (typically "YYYY-MM-DD" string). |
subjects |
list[str] | None
|
A list of subject classifications for the project. |
summary |
str | None
|
A summary or abstract of the project. |
websiteUrl |
str | None
|
The URL of the project's official website. |
Source code in src/aireloom/models/project.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
parse_keywords_string(v)
classmethod
Attempts to parse a keyword string into a list of strings.
If the input v
is a string, this validator tries to split it by common
delimiters (comma, then semicolon). If splitting results in more than one
part, a list of stripped parts is returned. Otherwise, the original string
(or None if empty) is returned. If v
is not a string (e.g., already a
list or None), it's returned as is.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
Any
|
The value to parse, expected to be a string, list, or None. |
required |
Returns:
Type | Description |
---|---|
list[str] | str | None
|
A list of strings if parsing was successful and yielded multiple keywords, |
list[str] | str | None
|
the original string if no parsing occurred or yielded a single part, |
list[str] | str | None
|
or None if the input string was empty. |
Source code in src/aireloom/models/project.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
ResearchProduct
Bases: BaseEntity
Model representing an OpenAIRE Research Product entity.
This is a central model in OpenAIRE, representing various outputs of research
such as publications, datasets, software, or other types. It aggregates
numerous metadata fields. Inherits id
from BaseEntity
.
Attributes:
Name | Type | Description |
---|---|---|
originalIds |
list[str] | None
|
A list of original identifiers for the research product. |
pids |
list[Pid] | None
|
A list of |
type |
ResearchProductType | None
|
The |
title |
str | None
|
The main title of the research product. |
authors |
list[Author] | None
|
A list of |
bestAccessRight |
BestAccessRight | None
|
A |
country |
ResultCountry | None
|
A |
description |
str | None
|
A textual description or abstract of the research product. |
publicationDate |
str | None
|
The publication date of the research product (YYYY-MM-DD string). |
publisher |
str | None
|
The name of the publisher. |
indicators |
Indicator | None
|
An |
instances |
list[Instance] | None
|
A list of |
language |
Language | None
|
A |
subjects |
list[Subject] | None
|
A list of |
container |
Container | None
|
A |
geoLocation |
GeoLocation | None
|
A |
keywords |
list[str] | None
|
A list of keywords. A validator attempts to parse comma-separated strings. |
journal |
Container | None
|
An alias or alternative field for |
Source code in src/aireloom/models/research_product.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
get_title_from_main_title(data)
classmethod
Populates the title
field from mainTitle
if title
is not present.
The OpenAIRE API sometimes uses mainTitle
for the primary title. This
validator ensures that the title
field in the Pydantic model is populated
using mainTitle
if title
itself is missing in the input data, effectively
aliasing mainTitle
to title
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Any
|
The raw input data dictionary before validation. |
required |
Returns:
Type | Description |
---|---|
Any
|
The (potentially modified) input data dictionary. |
Source code in src/aireloom/models/research_product.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
split_keywords(v)
classmethod
Attempts to split a comma-separated string of keywords into a list.
If the input v
is a string, it's split by commas, and each part is stripped
of whitespace. If v
is None or not a string, it's returned as is (or None
if the string was empty after stripping).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v
|
Any
|
The value to parse, expected to be a string or None. |
required |
Returns:
Type | Description |
---|---|
list[str] | None
|
A list of keyword strings, or None if input was None or empty. |
Source code in src/aireloom/models/research_product.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
|
ScholixCreator
Bases: BaseModel
Represents a creator (e.g., author, contributor) in the Scholix schema.
Attributes:
Name | Type | Description |
---|---|---|
name |
str | None
|
The name of the creator (aliased from "Name"). |
identifier |
list[ScholixIdentifier] | None
|
An optional list of |
Source code in src/aireloom/models/scholix.py
44 45 46 47 48 49 50 51 52 53 54 55 |
|
ScholixEntity
Bases: BaseModel
Represents a scholarly entity (source or target) in a Scholix relationship.
Attributes:
Name | Type | Description |
---|---|---|
identifier |
list[ScholixIdentifier]
|
A list of |
type |
ScholixEntityTypeName
|
The |
sub_type |
str | None
|
An optional subtype providing more specific classification. |
title |
str | None
|
The title of the scholarly entity. |
creator |
list[ScholixCreator] | None
|
A list of |
publication_date |
str | None
|
The publication date of the entity (string format). |
publisher |
list[ScholixPublisher] | None
|
A list of |
Source code in src/aireloom/models/scholix.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
ScholixIdentifier
Bases: BaseModel
Represents a persistent identifier within the Scholix schema.
Attributes:
Name | Type | Description |
---|---|---|
id_val |
str
|
The value of the identifier (aliased from "ID"). |
id_scheme |
str
|
The scheme of the identifier (aliased from "IDScheme", e.g., "doi", "url"). |
id_url |
HttpUrl | None
|
An optional resolvable URL for the identifier (aliased from "IDURL"). |
Source code in src/aireloom/models/scholix.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
ScholixLinkProvider
Bases: BaseModel
Represents the provider of the Scholix link.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the link provider (aliased from "Name"). |
identifier |
list[ScholixIdentifier] | None
|
An optional list of |
Source code in src/aireloom/models/scholix.py
113 114 115 116 117 118 119 120 121 122 123 124 |
|
ScholixPublisher
Bases: BaseModel
Represents a publisher in the Scholix schema.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the publisher (aliased from "Name"). |
identifier |
list[ScholixIdentifier] | None
|
An optional list of |
Source code in src/aireloom/models/scholix.py
58 59 60 61 62 63 64 65 66 67 68 69 |
|
ScholixRelationship
Bases: BaseModel
Represents a single Scholix relationship link between two scholarly entities.
This is a core model in the Scholix schema, detailing the link provider, the type of relationship, the source entity, and the target entity.
Attributes:
Name | Type | Description |
---|---|---|
link_provider |
list[ScholixLinkProvider] | None
|
A list of |
relationship_type |
ScholixRelationshipType
|
A |
source |
ScholixEntity
|
A |
target |
ScholixEntity
|
A |
link_publication_date |
datetime | None
|
The date when this link was published or made available. |
license_url |
HttpUrl | None
|
An optional URL pointing to the license governing the use of this link information. |
harvest_date |
str | None
|
The date when this link information was last harvested or updated. |
Source code in src/aireloom/models/scholix.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
ScholixResponse
Bases: BaseModel
Response structure for the Scholexplorer Links endpoint.
Source code in src/aireloom/models/scholix.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|