ssb_dash_framework.modules package¶
ssb_dash_framework.modules.aarsregnskap module¶
- class Aarsregnskap¶
Bases:
ABC
Module for displaying annual financial statements (Årsregnskap).
- label¶
Label for the module when initialized, displayed as “🧾 Årsregnskap”.
- Type:
str
- abstract layout()¶
Define the layout for the Aarsregnskap module.
This is an abstract method that must be implemented by subclasses to define the module’s layout.
- Returns:
A Dash HTML Div component representing the layout of the module.
- Return type:
html.Div
- module_callbacks()¶
Registers Dash callbacks for the Årsregnskap module.
- Return type:
None
ssb_dash_framework.modules.freesearch module¶
- class FreeSearch(database, label='🔍 Frisøk')¶
Bases:
ABC
Base class for creating a free-text SQL query interface with results displayed in an AgGrid table.
This class serves as a template for modules that allow users to: - Enter SQL queries in a text area. - Optionally specify partition filters as a dictionary string. - Display query results in an editable Dash AgGrid table.
- Parameters:
database (Any)
label (str | None)
- database¶
Database connection or interface for executing SQL queries.
- Type:
Any
- label¶
Label for the module, defaults to “🔍 Frisøk”.
- Type:
str
- module_layout¶
The generated layout for the module.
- Type:
html.Div
- layout()¶
Abstract method to define the module’s layout.
- Return type:
Div
- module_callbacks()¶
Registers the Dash callbacks for interactivity.
- Return type:
None
- abstract layout()¶
Define the layout for the FreeSearch module.
This is an abstract method that must be implemented by subclasses to define the module’s layout.
- Returns:
A Dash HTML Div component representing the layout of the module.
- Return type:
html.Div
- module_callbacks()¶
Register the Dash callbacks for the FreeSearch module.
This method registers a callback to execute the SQL query when the “kjør” button is clicked. The query results are displayed in the AgGrid table, with appropriate column definitions.
- Return type:
None
Notes
The callback takes user inputs from the SQL query text area and partition filter input field.
The results are displayed in an editable table, with the “row_id” column hidden by default if present.
ssb_dash_framework.modules.skjemadataviewer module¶
ssb_dash_framework.modules.skjemapdfviewer module¶
- class SkjemapdfViewer(form_identifier, pdf_folder_path)¶
Bases:
ABC
Module for displaying PDF forms in a tab.
- Parameters:
form_identifier (str)
pdf_folder_path (str)
- label¶
Label for the tab, displayed as “🗎 Skjema”.
- Type:
str
- pdf_folder_path¶
Path to the folder containing the PDF files.
- Type:
str
- is_valid(form_identifier)¶
Validate the form identifier and PDF folder path.
- Parameters:
form_identifier (str) – The identifier for the form.
- Raises:
ValueError – If the form identifier is not found in the VariableSelector.
- Return type:
None
- abstract layout()¶
Define the layout for the FreeSearch module.
This is an abstract method that must be implemented by subclasses to define the module’s layout.
- Returns:
A Dash HTML Div component representing the layout of the module.
- Return type:
html.Div
- module_callbacks()¶
Register Dash callbacks for the SkjemapdfViewer module.
- Return type:
None
Notes
The first callback updates the form identifier input field.
The second callback fetches and encodes the PDF file as a data URI for display in the iframe.