httk.serve.web.widgets.optimade_table

The HTML/configuration boundary for the browser-driven OPTIMADE table.

Attributes

Exceptions

OptimadeTableProtocolError

A declared OPTIMADE table shell cannot meet the browser protocol.

Functions

render(context, *, base_url[, entry_type, page_size, ...])

Render an inert, accessible OPTIMADE table shell and trusted assets.

Module Contents

httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_URL_CHARS = 2048[source]
httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_IDENTIFIER_CHARS = 128[source]
httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_TEXT_CHARS = 4096[source]
httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_LABEL_CHARS = 256[source]
httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_ORIGINS = 16[source]
httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_COLUMNS = 32[source]
httk.serve.web.widgets.optimade_table.MAX_OPTIMADE_SUMMARY_FIELDS = 64[source]
exception httk.serve.web.widgets.optimade_table.OptimadeTableProtocolError[source]

Bases: ValueError

A declared OPTIMADE table shell cannot meet the browser protocol.

httk.serve.web.widgets.optimade_table.render(context, *, base_url, entry_type='structures', columns, page_size=50, page_size_options=None, page_size_query=None, caption='OPTIMADE results', filter=None, filter_query=None, sort=None, sort_query=None, sort_aliases=None, allowed_origins=(), detail_route=None, detail_column=None, detail_query='id', summary=None, advanced_filter=None)[source]

Render an inert, accessible OPTIMADE table shell and trusted assets.

The browser negotiates continuation URLs from inert configuration; those URLs are not placed in DOM attributes, events, storage, or history. allowed_origins is a client continuation allow-list, not an access control boundary. filter_query and sort_query replace the whole browser filter and sort values.

Parameters:
  • context (httk.serve.web.widgets.core.WidgetContext) – Immutable widget invocation context.

  • base_url (str) – Origin- or path-relative OPTIMADE endpoint base URL.

  • entry_type (str) – OPTIMADE entry resource type.

  • columns (object) – Column names or column mappings to display.

  • page_size (int) – Number of entries requested per browser page.

  • page_size_options (object) – Optional sequence of 1-8 distinct page-size integers (each 1..500) offered by the page-size dropdown. None uses (50, 100, 500). The current page_size is always included as an option; the list is sorted ascending.

  • page_size_query (str | None) – Query parameter name whose value selects a page size from the options. The dropdown renders only when this is set.

  • caption (str) – Accessible table caption.

  • filter (str | None) – Initial OPTIMADE filter expression.

  • filter_query (str | None) – Whole-filter query parameter name used by the browser.

  • sort (str | None) – Optional OPTIMADE sort expression.

  • sort_query (str | None) – Query parameter name whose complete value replaces sort.

  • sort_aliases (collections.abc.Mapping[str, str] | None) – Optional mapping of display sort values (e.g. a human-facing "rank") to complete OPTIMADE sort expressions. The browser resolves an authored or URL-supplied sort through this mapping before querying, so a display alias is never sent to OPTIMADE; unmapped values pass through unchanged.

  • allowed_origins (tuple[str, Ellipsis]) – Client-side allow-list for continuation origins.

  • detail_route (str | None) – Optional site route for entry details.

  • detail_column (str | None) – Column supplying the detail value.

  • detail_query (str) – Query parameter receiving the detail value.

  • summary (object) – Optional results-summary configuration. None disables it, True enables it with defaults (noun "entries"), and a mapping may set noun and a fields mapping of property name to label, format, and values overlays used to describe the active filter and sort in human terms. Field presentation defaults to the matching column’s label and format.

  • advanced_filter (object) – Optional advanced-filter disclosure configuration. None disables it, True enables it with defaults, and a mapping may set label (the disclosure heading) and help_url (an absolute HTTP(S) URL or site-relative path to an “available fields” reference). The disclosure is a plain GET form that submits a raw OPTIMADE filter under the filter_query parameter, so it requires filter_query to be set.

Returns:

Accessible table shell and its trusted assets.

Raises:

OptimadeTableProtocolError – If configuration violates the browser protocol.

Return type:

httk.serve.web.widgets.core.WidgetRenderResult