httk.optimade.backend.adapter

Attributes

Classes

EntrySource

One queryable source (table/type) behind an OPTIMADE entry endpoint.

BackendAdapter

Binds a store to the OPTIMADE entry endpoints it serves.

Module Contents

type httk.optimade.backend.adapter.FieldExtractor = Callable[[Any], Any][source]
class httk.optimade.backend.adapter.EntrySource[source]

One queryable source (table/type) behind an OPTIMADE entry endpoint.

target is what gets passed to searcher.variable(); fields maps OPTIMADE response-field names to extractors applied to matched row objects. relationships, when set, is an extractor mapping a matched row to a dictionary keyed by related entry type, each value a list of {'id': str, 'description': str?, 'role': str?} dictionaries. sort_keys maps response-field names to the backend field names to sort on. property_metadata maps response-field names to extractors returning the per-property metadata dictionary for a matched row (or None when there is no metadata for that row).

target: Any[source]
fields: collections.abc.Mapping[str, FieldExtractor][source]
sort_keys: collections.abc.Mapping[str, str][source]
relationships: FieldExtractor | None = None[source]
property_metadata: collections.abc.Mapping[str, FieldExtractor][source]
class httk.optimade.backend.adapter.BackendAdapter[source]

Binds a store to the OPTIMADE entry endpoints it serves.

sources maps entry endpoint names (e.g. 'structures') to the sources queried for that endpoint; an endpoint with several sources (e.g. several calculation result types) is queried across all of them.

schema is required: it declares the served entry types and properties. field_handlers maps each entry type to its filter-handler table. When omitted (left empty) it is derived from schema via simple_property_handlers(), using an identity property-key map (each property is filtered against a backend field of the same name); a backend whose field names differ, or that wants finer control, supplies its own tables instead.

store: httk.data.query.Store[source]
sources: collections.abc.Mapping[str, collections.abc.Sequence[EntrySource]][source]
schema: httk.optimade.schema.served.ServedSchema[source]
field_handlers: collections.abc.Mapping[str, httk.data.optimade_query.HandlerTable][source]
query_function() httk.optimade.model.results.QueryFunction[source]