Skip to content

filter

Models specific to the filter strategy.

OPTIMADEFilterConfig

Bases: FilterConfig

OPTIMADE-specific filter strategy config.

Note

The condition parameter is not taken into account.

Source code in oteapi_optimade/models/strategies/filter.py
13
14
15
16
17
18
19
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
class OPTIMADEFilterConfig(FilterConfig):
    """OPTIMADE-specific filter strategy config.

    Note:
        The `condition` parameter is not taken into account.

    """

    filterType: Annotated[
        Literal["optimade"],
        BeforeValidator(lambda x: x.lower() if isinstance(x, str) else x),
        Field(
            description="The registered strategy name for OPTIMADEFilterStrategy.",
        ),
    ]
    query: Annotated[
        Optional[str],
        Field(
            description=(
                "The `filter` OPTIMADE query parameter value. This parameter value can "
                "also be provided through the [`configuration.query_parameters.filter`]"
                "[oteapi_optimade.models.query.OPTIMADEQueryParameters.filter] parameter. "
                "Note, this value takes precedence over [`configuration`][oteapi_optimade."
                "models.strategies.filter.OPTIMADEFilterConfig.configuration] values."
            ),
        ),
    ] = None
    limit: Annotated[
        Optional[int],
        Field(
            description=(
                "The `page_limit` OPTIMADE query parameter value. This parameter value can"
                " also be provided through the [`configuration.query_parameters."
                "page_limit`][oteapi_optimade.models.query.OPTIMADEQueryParameters."
                "page_limit] parameter. Note, this value takes precedence over "
                "[`configuration`][oteapi_optimade.models.strategies.filter."
                "OPTIMADEFilterConfig.configuration] values."
            ),
        ),
    ] = None
    configuration: Annotated[
        OPTIMADEConfig,
        Field(
            description=(
                "OPTIMADE configuration. Contains relevant information necessary to "
                "perform OPTIMADE queries."
            ),
        ),
    ] = OPTIMADEConfig()

OPTIMADEFilterResult

Bases: AttrDict

OPTIMADE session for the filter strategy.

Source code in oteapi_optimade/models/strategies/filter.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
class OPTIMADEFilterResult(AttrDict):
    """OPTIMADE session for the filter strategy."""

    model_config = ConfigDict(validate_assignment=True, arbitrary_types_allowed=True)

    optimade_config: Annotated[
        Optional[OPTIMADEConfig],
        Field(
            description=(
                "OPTIMADE configuration. Contains relevant information necessary to "
                "perform OPTIMADE queries."
            ),
        ),
    ] = None
    optimade_response_model: Annotated[
        Optional[tuple[str, str]],
        Field(
            description=(
                "An OPTIMADE Python tools (OPT) pydantic successful response model. "
                "More specifically, a tuple of the module and name of the pydantic "
                "model."
            ),
        ),
    ] = None
    optimade_response: Annotated[
        Optional[dict[str, Any]],
        Field(
            description="An OPTIMADE response as a Python dictionary.",
        ),
    ] = None