httk.serve.optimade.backend.adapter¶
Adapt store/searcher implementations to the OPTIMADE backend contract.
Attributes¶
Classes¶
Describe one queryable source behind an OPTIMADE entry endpoint. |
|
Bind a store to the OPTIMADE entry endpoints it serves. |
Module Contents¶
- class httk.serve.optimade.backend.adapter.EntrySource[source]¶
Describe one queryable source behind an OPTIMADE entry endpoint.
targetis what gets passed tosearcher.variable();fieldsmaps 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_keysmaps response-field names to the backend field names to sort on.property_metadatamaps response-field names to extractors returning the per-property metadata dictionary for a matched row (orNonewhen there is no metadata for that row).- Parameters:
target – Store-specific target passed to
searcher.variable.fields – Response-field extractors applied to matched rows.
sort_keys – Response-field to backend-sort-field mappings.
relationships – Optional extractor for related-resource data.
property_metadata – Optional per-property metadata extractors.
- sort_keys: collections.abc.Mapping[str, str][source]¶
- relationships: FieldExtractor | None = None[source]¶
- property_metadata: collections.abc.Mapping[str, FieldExtractor][source]¶
- class httk.serve.optimade.backend.adapter.BackendAdapter[source]¶
Bind a store to the OPTIMADE entry endpoints it serves.
sourcesmaps 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.schemais required: it declares the served entry types and properties.field_handlersmaps each entry type to its filter-handler table. When omitted (left empty) it is derived fromschemaviasimple_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.- Parameters:
store – Store implementing the neutral query protocol.
sources – Queryable sources keyed by entry endpoint.
schema – Required schema describing served entries and properties.
field_handlers – Optional filter handlers keyed by entry endpoint.
- field_handlers: collections.abc.Mapping[str, httk.store.query.optimade_filters.HandlerTable][source]¶