Filters¶
Filters that narrow a pipeline, used in YAML specs and Python.
lumen.filters
¶
base
¶
The Filter components supply query parameters used to filter the tables returned by a Source.
BaseDateFilter
¶
Bases:
mode = param.Selector(default='slider', objects=['slider', 'picker'], doc='\n Whether to use a slider or a picker.')
class-attribute
instance-attribute
¶
multi = param.Boolean(default=True, doc='\n Whether to use a single-value or multi-value/range selection widget.')
class-attribute
instance-attribute
¶
panel
property
¶
query
property
¶
throttled = param.Boolean(default=True, doc='\n Whether to throttle slider value changes.')
class-attribute
instance-attribute
¶
widget = widget_type(**(self._widget_kwargs(as_date=(self._as_date))))
instance-attribute
¶
BaseWidgetFilter
¶
Bases:
default = param.Parameter(doc='\n The default value to use on the widget.')
class-attribute
instance-attribute
¶
disabled = param.Boolean(default=False, doc='\n Whether the filter should be disabled.')
class-attribute
instance-attribute
¶
panel
property
¶
throttled = param.Boolean(default=True, doc='\n If the widget has a value_throttled parameter use that instead,\n ensuring that no intermediate events are generated, e.g. when\n dragging a slider.')
class-attribute
instance-attribute
¶
visible = param.Boolean(default=True, doc='\n Whether the filter should be visible.')
class-attribute
instance-attribute
¶
widget = None
instance-attribute
¶
BinFilter
¶
Bases:
BinFilter is a special WidgetFilter that allows selecting from a set of bins.
The bins must be declared from a list of tuples declaring the
lower- and upper-bound of each bin and an optional set of labels
of the same length.
bins = param.List(default=[], constant=True, doc='\n A list of bins expressed as length two tuples.')
class-attribute
instance-attribute
¶
empty_select = param.Boolean(default=True, doc='\n Add an option to Select widgets to indicate no filtering.')
class-attribute
instance-attribute
¶
filter_type = 'bins'
class-attribute
¶
labels = param.List(default=None, constant=True, doc='\n A list of labels for each bin (optional).')
class-attribute
instance-attribute
¶
multi = param.Boolean(default=True, doc='\n Whether to use a single-value or multi-value selection widget.')
class-attribute
instance-attribute
¶
query
property
¶
widget = widget(label=(self.label), options=options, value=value)
instance-attribute
¶
ConstantFilter
¶
DateFilter
¶
Bases:
DateFilter is a WidgetFilter specialized to select calendar dates.
Depending on whether multi selection is enabled a single date or
range of dates can be selected with a DatePicker or
DateRangeSlider respectively.
filter_type = 'date'
class-attribute
¶
DatetimeFilter
¶
Bases:
DatetimeFilter is a WidgetFilter specialized to filter by datetimes.
Depending on whether multi selection is enabled a single date or
range of dates can be selected with a DatetimePicker or
DatetimeRangeSlider respectively.
filter_type = 'datetime'
class-attribute
¶
FacetFilter
¶
Filter
¶
Bases:
Filter components supply the filter values used by Source components to query data. .
field = param.String(doc='The field being filtered.')
class-attribute
instance-attribute
¶
filter_type = None
class-attribute
¶
label = param.String(doc='A label for the Filter.')
class-attribute
instance-attribute
¶
panel
property
¶
Returns:
| Type | Description |
|---|---|
|
A Panel Viewable object representing the filter. |
query
property
¶
Returns:
| Type | Description |
|---|---|
|
The current filter query which will be used by the Source to filter the data. |
schema = param.Dict(doc='\n The JSON schema provided by the Source declaring information\n about the data to be filtered.')
class-attribute
instance-attribute
¶
shared = param.Boolean(default=False, doc='\n Whether the filter is shared across all layouts.')
class-attribute
instance-attribute
¶
sync_with_url = param.Boolean(default=True, doc='\n Whether to sync the filter state with the URL parameters.')
class-attribute
instance-attribute
¶
table = param.String(default=None, doc='\n The table being filtered. If None applies to all tables.')
class-attribute
instance-attribute
¶
value = param.Parameter(doc='The current filter value.')
class-attribute
instance-attribute
¶
from_spec(spec, source_schema, source_filters=None)
classmethod
¶
Resolves a Filter specification given the schema of the Source (and optionally the table) it will be filtering on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
|
Specification declared as a dictionary of parameter values. |
required |
source_schema
|
|
A dictionary containing the JSON schema of the Source to be filtered on. |
required |
source_filters
|
|
A dictionary of filters associated with the Source |
None
|
Returns:
| Type | Description |
|---|---|
The resolved Filter object.
|
|
to_spec(context=None)
¶
validate(spec, context=None)
classmethod
¶
ParamFilter
¶
Bases:
ParamFilter reflects the value of a parameter declared on a View.
The ParamFilter can be used to implement cross-filtering between
different views.
WidgetFilter
¶
Bases:
WidgetFilter generates a Widget from the table schema provided by a Source.
By default the widget type will be inferred from the data and
depending on whether multi value selection is enabled.