Filters

The Filter classes provide the ability to query just a subset of the data provided by a Source. They therefore provide a powerful mechanism to drill down into just a subset of the data.

The Filter API is very simple:

class lumen.filters.Filter(**params)

A Filter provides a query which will be used to filter the data returned by a Source.

field = param.String(readonly=False)

The field being filtered.

label = param.String(readonly=False)

A label for the Filter.

schema = param.Dict(readonly=False)

The JSON schema provided by the Source declaring information about the data to be filtered.

shared = param.Boolean(readonly=False)

Whether the filter is shared across all targets.

table = param.String(readonly=False)

The table being filtered. If None applies to all tables.

value = param.Parameter(readonly=False)

The current filter value.

classmethod from_spec(spec, source_schema, source_filters=None)

Resolves a Filter specification given the schema of the Source (and optionally the table) it will be filtering on.

Parameters
  • spec (dict or str) – Specification declared as a dictionary of parameter values.

  • source_schema (dict) – A dictionary containing the JSON schema of the Source to be filtered on.

  • source_filters (dict) – A dictionary of filters associated with the Source

Returns

Return type

The resolved Filter object.

property panel

returns: A Panel Viewable object representing the filter. :rtype: panel.Viewable or None

property query
returns: The current filter query which will be used by the

Source to filter the data.

Return type

object

Filter types

class lumen.filters.ConstantFilter(**params)

The ConstantFilter allows requesting a constant value from the Source.

Parameters inherited from:

lumen.filters.base.Filter: field, label, schema, shared, table, value

class lumen.filters.FacetFilter(**params)

The FacetFilter allows faceting the data along some dimension to allow a single View to be exploded into multiple by grouping over one of the indexes.

Parameters inherited from:

lumen.filters.base.Filter: field, label, schema, shared, table, value

class lumen.filters.WidgetFilter(**params)

The WidgetFilter generates a Widget from the table schema provided by a Source and returns the current widget value to query the data returned by the Source.

Parameters inherited from:

lumen.filters.base.Filter: field, label, schema, shared, table, value

default = param.Parameter(readonly=False)

The default value to use on the widget.

empty_select = param.Boolean(readonly=False)

Add an option to Select widgets to indicate no filtering.

multi = param.Boolean(readonly=False)

Whether to use a single-value or multi-value selection widget, e.g. for a numeric value this could be a regular slider or a range slider.

widget = param.ClassSelector(readonly=False)