YAML configuration reference¶
An app can be configured with a yaml file instead of Python code. This page lists every class that can be created from yaml, and which arguments each class accepts.
Key concepts¶
Yaml maps 1-to-1 onto Python arguments. Every key in a yaml block is passed as a
keyword argument with the same name to the class constructor (__init__). If you
know how to create a class in Python, you know how to configure it in yaml, and the
other way around. These two are equivalent:
FreeSearch(conn=None)
- type: FreeSearch
conn: null
type selects the class. The value of type must match the class name exactly.
All other keys in the block become arguments. Unknown keys are rejected with an
error listing the valid arguments.
The app config file. The root of an app config has two sections:
app_settings: # Arguments to app_setup(), and the variable selector config
port: 8070
variableselector:
ident: ident
modules:
tabs: # Modules shown as tabs
- type: SomeModule
windows: # Modules shown as windows (modals) opened from the sidebar
- type: OtherModule
Whether a module is a tab or a window is decided by which list it is placed in, so
as_type should not be set in yaml.
Nested classes. Some arguments expect other configurable classes. These are
written as nested blocks with their own type key, following the same rules.
Splitting files. Use !include path/to/file.yaml to insert the content of another
yaml file. Relative paths are resolved from the folder of the including file.
Custom from_yaml. Most classes use the default loader, which passes the yaml
keys straight to the constructor. Some classes need to build objects from the yaml
before calling the constructor, and define their own from_yaml. This is noted in
the class section below, and the expected structure may differ from the
constructor arguments listed.
Contents¶
Aarsregnskap¶
Import path: ssb_dash_framework.modules.aarsregnskap.Aarsregnskap
Module for displaying annual financial statements (Årsregnskap).
Takes no arguments.
- type: Aarsregnskap
ControlView¶
Import path: ssb_dash_framework.modules.altinn_control_view.ControlView
Provides a layout and functionality for a modal that offers a tabular view of the controls.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
A dictionary with one control class per skjema. |
|
|
|
Variable selector fields to output to. Defaults to [‘ident’] |
- type: ControlView
control_dict: <control_dict>
BofInformation¶
Import path: ssb_dash_framework.modules.bofregistry.BofInformation
Module for displaying and managing information from BoF.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
The label for the tab, displayed as “BoF Foretak”. |
|
|
|
The name of the variable selector that holds the foretak number, default is “foretak”. |
- type: BofInformation
Canvas¶
Import path: ssb_dash_framework.modules.building_blocks.canvas.Canvas
The Canvas module is a base class that simplifies adding your own unique view to the framework.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The label for the canvas, used in the UI. |
|
|
required |
A Dash layout that will be displayed in the canvas. Can contain other building block modules. |
- type: Canvas
label: <label>
content: <content>
FigureDisplay¶
Import path: ssb_dash_framework.modules.building_blocks.figuredisplay.FigureDisplay
This module is used to display a plotly figure in the editing framework.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The label for the module. |
|
|
required |
A function that returns a plotly figure. It should accept the dynamic states as arguments. |
|
|
required |
A list of input variable names to be used in the figure function. |
|
|
|
A list of state variable names to be used in the figure function. Defaults to None. |
|
|
|
The name of the output variable to which the click data will be sent. If provided, the click data will be processed and sent to this variable. If None, no click data will be processed. Defaults to None. |
|
|
|
A function to process the click data. It should accept the click data as an argument and return a value to be sent to the output variable. If None, no click data will be processed. Defaults to None. |
Additional keyword arguments are accepted.
- type: FigureDisplay
label: <label>
figure_func: <figure_func>
inputs: <inputs>
MapDisplay¶
Import path: ssb_dash_framework.modules.building_blocks.map_display.MapDisplay
Module used for creating a map visualization.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The kind of map to be made, currently supports kommune and fylke. |
|
|
required |
List the variables from the variable selector that should trigger an update to the map |
|
|
required |
List the variables from the variable selector that should be used in the get_data_func, but not trigger an update to the map |
|
|
required |
Function that when given aar_var, *inputs and *states as arguments returns a dataframe with a column with the same name as the map type and ‘value’ for the value. |
|
|
|
A function to process the click data. It should accept the click data as an argument and return a value to be sent to the output variable. If None, no click data will be processed. Defaults to None. |
|
|
|
Variable selector output for clickdata. Defaults to the same value as map_type. |
|
|
|
Label for the button / tab for the module. Defaults to ‘Kart {map_type}’ |
|
|
|
Can be used to select another colorscale. See plotly documentation for options. |
- type: MapDisplay
map_type: <map_type>
inputs: <inputs>
states: <states>
get_data_func: <get_data_func>
MultiModule¶
Import path: ssb_dash_framework.modules.building_blocks.multimodule.MultiModule
Generic class for switching between modules with a label and module_layout.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The label for the MultiModule. |
|
|
required |
A list of modules to switch between. Each module should have a |
- type: MultiModule
label: <label>
module_list: <module_list>
EditingTable¶
Import path: ssb_dash_framework.modules.building_blocks.tables.EditingTable
A reusable and flexible Dash component for editing tabular data.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The label for the tab or component, used for display purposes. |
|
|
required |
A list of input variable names that will trigger callbacks. |
|
|
required |
A list of state variable names used that will not trigger callbacks, but can be provided as args. |
|
|
required |
A function that returns a pandas dataframe. |
|
|
|
A function for updating data based on edits in the AgGrid. Note, the update_table_func is provided with the dict from cellValueChanged[0] from the Dash AgGrid in addition the inputs and states values. |
|
|
|
Identifier for the table, used for callbacks. Defaults to None. |
|
|
|
Identifier for the variable selector. If list, make sure it is in the same order as output. Defaults to None. If |
|
|
|
A d3 format string for formatting numeric values in the table. Defaults to None. If None, it will default to “d3.format(‘,.1f’)(params.value).replace(/,/g, ‘ ‘)”. |
Additional keyword arguments are accepted.
- type: EditingTable
label: <label>
inputs: <inputs>
states: <states>
get_data_func: <get_data_func>
AltinnFormParqueditHandler¶
Import path: ssb_dash_framework.modules.data_editor.default_getter.form_tools_parquedit_handler.AltinnFormParqueditHandler
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
- type: AltinnFormParqueditHandler
conn: <conn>
StandardDataHandler¶
Import path: ssb_dash_framework.modules.data_editor.default_getter.getter.StandardDataHandler
Takes no arguments.
- type: StandardDataHandler
DataEditor¶
Import path: ssb_dash_framework.modules.data_editor.editor.DataEditor
The main micro-editing module that orchestrates layout, sidebars, and custom forms.
Custom loader: from_yaml(*args: Any, **kwargs: dict | list | str | int).
Configures and instantiates the DataEditor module dynamically from a configuration dict/yaml.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
Central configuration for columns, tables, and form options. |
|
|
required |
Query and persistence handler implementing FetcherMeta. |
|
|
|
Variable mapping configuration for the metadata display row. |
|
|
|
List of helper buttons/modals shown above the main content view. |
|
|
|
List of interactive sidebar widgets shown in the left column. |
|
|
|
List of views (e.g. DataEditorTable or DataViewCustom) for standard or customized forms. |
|
|
|
Optional flag to toggle the data source selector. |
- type: DataEditor
settings: <settings>
data_handler: <data_handler>
ContextABC¶
Import path: ssb_dash_framework.modules.data_editor.meta.ContextABC
Base class for defining a module operating within a specific database and layout context.
Takes no arguments.
Additional keyword arguments are accepted.
- type: ContextABC
DataViewCustom¶
Import path: ssb_dash_framework.modules.data_editor.modules.data_view.custom_view.DataViewCustom
DataView with a very flexible layout made to be tailored to specific needs.
Custom loader: from_yaml(*args, **kwargs).
Configures and instantiates the custom view dynamically from configuration dictionary properties.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
Additional keyword arguments are accepted.
- type: DataViewCustom
layout: <layout>
DataEditorTable¶
Import path: ssb_dash_framework.modules.data_editor.modules.data_view.table_view.DataEditorTable
Requires table selector.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
Central configurations defining data tables, fields, and options. |
- type: DataEditorTable
settings: <settings>
DataEditorContactInfo¶
Import path: ssb_dash_framework.modules.data_editor.modules.helper_buttons.contact_info.DataEditorContactInfo
This module provides supporting tables for the DataEditor.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
|
|
|
|
- type: DataEditorContactInfo
DataEditorHistory¶
Import path: ssb_dash_framework.modules.data_editor.modules.helper_buttons.history.DataEditorHistory
This module provides supporting tables for the DataEditor.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Optional override listing applicable database tables. |
|
|
|
Optional override listing applicable questionnaire forms. |
- type: DataEditorHistory
DataEditorSupportTables¶
Import path: ssb_dash_framework.modules.data_editor.modules.helper_buttons.supporting_table.DataEditorSupportTables
Module providing a collection of supporting reference tables inside a modal.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Optional override listing applicable database tables. |
|
|
|
Optional override listing applicable questionnaire forms. |
- type: DataEditorSupportTables
DataEditorInfoRow¶
Import path: ssb_dash_framework.modules.data_editor.modules.inforow.info_row.DataEditorInfoRow
Creates a row of cards at top of DataEditor showing key variables for selected form.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
A list of InfoRowField objects or a dict where the key is the label for the variable. In a dict the values must be {source: “sourcetable”, variable_name: “variable name in table”} |
- type: DataEditorInfoRow
variables: <variables>
DataEditorTableSelector¶
Import path: ssb_dash_framework.modules.data_editor.modules.sidebar.table_selector.DataEditorTableSelector
Default module to select datasource table to show data for.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
A list of tables in the database to select from. |
|
|
required |
Sets the default table value to display first. |
- type: DataEditorTableSelector
form_data_tables: <form_data_tables>
starting_table: <starting_table>
Naeringsspesifikasjon¶
Import path: ssb_dash_framework.modules.nspek.nspek.Naeringsspesifikasjon
The Naeringsspesifikasjon module lets you view the nspek/naeringsspesifikasjon for a specified foretak (var-ident).
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
|
|
|
|
- type: Naeringsspesifikasjon
time_units: <time_units>
NspekControlView¶
Import path: ssb_dash_framework.modules.nspek.nspek_control_view.NspekControlView
Nspek variant av ControlView - tett på original implementasjon, men med control_class og uten hard dependency på altinnskjema.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
|
|
|
required |
|
|
|
|
- type: NspekControlView
time_units: <time_units>
control_class: <control_class>
NspekDashboard¶
Import path: ssb_dash_framework.modules.nspek.nspek_dashboard.NspekDashboard
The Naeringsspesifikasjon module lets you view the nspek/naeringsspesifikasjon for a specified foretak (var-ident).
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
|
|
|
|
- type: NspekDashboard
time_units: <time_units>
ParquetEditor¶
Import path: ssb_dash_framework.modules.parquet_editor.ParquetEditor
Simple module with the sole purpose of editing a parquet file.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The name of the statistic being edited. |
|
|
required |
A list of columns that together form a unique identifier for a single row in your data. |
|
|
required |
The path to the parquet file you want to edit. |
|
|
required |
The period being edited. Data period controlled - eg. year, date, date-time. |
|
|
|
Decides if the table automatically filters based on updates in the variable selector. Defaults to False. |
|
|
|
Columns in your dataframe that should be clickable to output to the variable selector panel. |
|
|
|
If your dataframe column names do not match the names in the variable selector, this can be used to map columns names to variable selector names. See examples. |
|
|
|
Controls whether or not ParquetEditor allows potentially bug-inducing column names. Defaults to False. |
|
|
|
AgGrid defaults to None. This argument allows us to specify other params for height. |
Additional keyword arguments are accepted.
- type: ParquetEditor
statistics_name: <statistics_name>
id_vars: <id_vars>
data_source: <data_source>
data_period: <data_period>
ParquetEditorChangelog¶
Import path: ssb_dash_framework.modules.parquet_editor.ParquetEditorChangelog
Simple module with the sole purpose of showing the changes made using ParquetEditor.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
A list of columns that together form a unique identifier for a single row in your data. |
|
|
required |
The path to the parquet file you want to find the changelog for. |
- type: ParquetEditorChangelog
id_vars: <id_vars>
data_source: <data_source>
SkjemapdfViewer¶
Import path: ssb_dash_framework.modules.skjemapdfviewer.SkjemapdfViewer
Module for displaying PDF forms in a tab.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
required |
The identifier for the form. This should match the VariableSelector value. |
|
|
required |
The path to the folder containing the PDF files. |
- type: SkjemapdfViewer
form_identifier: <form_identifier>
pdf_folder_path: <pdf_folder_path>
VariableSelectorConfig¶
Import path: ssb_dash_framework.setup.variableselector.set_variables.VariableSelectorConfig
Configuration for the variable selector.
Not selected with type. Created with VariableSelectorConfig.from_yaml(...) or from the matching section of the app config.
Custom loader: from_yaml(yaml_path: str) -> 'VariableSelectorConfig'.
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Column containing reference number or similar unique identifier for observation. |
|
|
|
Primary identifier column |
|
|
|
Additional identifier columns |
|
|
|
Mapping of variable name to time unit type |
|
|
|
Variables used for grouping operations |
|
|
|
Variables that when changed, should not display an alert |