Skip to content

index_metadb

IndexInfoAttributes

Bases: BaseInfoAttributes

Attributes for Base URL Info endpoint for an Index Meta-Database

Source code in optimade/models/index_metadb.py
17
18
19
20
21
22
23
24
25
class IndexInfoAttributes(BaseInfoAttributes):
    """Attributes for Base URL Info endpoint for an Index Meta-Database"""

    is_index: Annotated[
        bool,
        StrictField(
            description="This must be `true` since this is an index meta-database (see section Index Meta-Database).",
        ),
    ] = True

api_version instance-attribute

available_api_versions instance-attribute

available_endpoints instance-attribute

entry_types_by_format instance-attribute

formats = ['json'] class-attribute instance-attribute

is_index = True class-attribute instance-attribute

formats_and_endpoints_must_be_valid()

Source code in optimade/models/baseinfo.py
112
113
114
115
116
117
118
119
120
121
122
@model_validator(mode="after")
def formats_and_endpoints_must_be_valid(self) -> "BaseInfoAttributes":
    for format_, endpoints in self.entry_types_by_format.items():
        if format_ not in self.formats:
            raise ValueError(f"'{format_}' must be listed in formats to be valid")
        for endpoint in endpoints:
            if endpoint not in self.available_endpoints:
                raise ValueError(
                    f"'{endpoint}' must be listed in available_endpoints to be valid"
                )
    return self

IndexInfoResource

Bases: BaseInfoResource

Index Meta-Database Base URL Info endpoint resource

Source code in optimade/models/index_metadb.py
46
47
48
49
50
51
52
53
54
55
56
57
class IndexInfoResource(BaseInfoResource):
    """Index Meta-Database Base URL Info endpoint resource"""

    attributes: IndexInfoAttributes
    relationships: Annotated[  # type: ignore[assignment]
        dict[Literal["default"], IndexRelationship] | None,
        StrictField(
            title="Relationships",
            description="""Reference to the Links identifier object under the `links` endpoint that the provider has chosen as their 'default' OPTIMADE API database.
A client SHOULD present this database as the first choice when an end-user chooses this provider.""",
        ),
    ]

attributes instance-attribute

id = '/' class-attribute instance-attribute

meta = None class-attribute instance-attribute

model_config = ConfigDict(json_schema_extra=resource_json_schema_extra) class-attribute instance-attribute

relationships instance-attribute

type = 'info' class-attribute instance-attribute

IndexRelationship

Bases: BaseModel

Index Meta-Database relationship

Source code in optimade/models/index_metadb.py
34
35
36
37
38
39
40
41
42
43
class IndexRelationship(BaseModel):
    """Index Meta-Database relationship"""

    data: Annotated[
        RelatedLinksResource | None,
        StrictField(
            description="""[JSON API resource linkage](http://jsonapi.org/format/1.0/#document-links).
It MUST be either `null` or contain a single Links identifier object with the fields `id` and `type`""",
        ),
    ]

data instance-attribute

RelatedLinksResource

Bases: BaseResource

A related Links resource object

Source code in optimade/models/index_metadb.py
28
29
30
31
class RelatedLinksResource(BaseResource):
    """A related Links resource object"""

    type: Literal["links"] = "links"

id instance-attribute

model_config = ConfigDict(json_schema_extra=resource_json_schema_extra) class-attribute instance-attribute

type = 'links' class-attribute instance-attribute