ssb_dash_framework.modals package¶
ssb_dash_framework.modals.altinn_control_view module¶
- class AltinnControlView(time_units, control_dict, conn)¶
Bases:
object
Provides a layout and functionality for a modal that offers a tabular view of the controls.
- Parameters:
time_units (list[str])
control_dict (dict[str, Any])
conn (object)
- time_units¶
A list of the time units used.
- Type:
list
- control_dict¶
A dictionary with one control class per skjema.
- Type:
dict
- conn¶
The eimerdb connection.
- Type:
object
- callbacks()¶
Registers Dash callbacks for the AltinnControlView module.
- Return type:
None
- create_callback_components(input_type='Input')¶
Generates a list of dynamic Dash Input or State components.
- Return type:
list
[str
]- Parameters:
input_type (Literal['Input', 'State'])
- create_partition_select(skjema=None, **kwargs)¶
Creates the partition select argument based on the chosen time units.
- Return type:
dict
[str
,list
[Any
]]- Parameters:
skjema (str | None)
kwargs (Any)
- layout()¶
Generates the layout for the AltinnControlView module.
- Returns:
A Div element containing two tables, kontroller and kontrollutslag.
- Return type:
layout
ssb_dash_framework.modals.altinn_data_capture module¶
- class AltinnDataCapture(time_units, database)¶
Bases:
object
Provides a layout and functionality for a modal that offers a graphical overview of the data capture from altinn3.
- Parameters:
time_units (list[str])
database (object)
- time_units¶
A list of the time units used.
- Type:
list
- database¶
The eimerdb connection.
- Type:
object
- callbacks()¶
Registers Dash callbacks for the Visualiseringsbygger module.
- Return type:
None
Notes
get_skjemas: Gets all the schemas from the eimerdb enheter table and adds them to a dropdown.
update_altinnskjema: Updates the chosen schema from the variable selector.
datafangstmodal_toggle: Toggles the modal, which contains the layout.
‘datafangst_graph’: Queries the skjemamottak table in eimerdb and returns a graph.
- create_callback_components(input_type='Input')¶
Generates a list of dynamic Dash Input or State components.
- Return type:
list
[Input
|State
]- Parameters:
input_type (Literal['Input', 'State'])
- create_partition_select(skjema=None, **kwargs)¶
Creates the partition select argument based on the chosen time units.
- Return type:
dict
[str
,Any
]- Parameters:
skjema (str | None)
kwargs (Any)
- layout()¶
Generates the layout for the AltinnDataCapture module.
- Returns:
A Div element containing components for the graphs.
- Return type:
layout
ssb_dash_framework.modals.control module¶
- class Control(ident)¶
Bases:
object
Provides a layout and functionality for a modal that offers an overview of data checks and control results.
- Parameters:
ident (str)
- ident¶
Name of the identification variable, e.g., ‘orgf’.
- Type:
str
- callbacks()¶
Sets up interactivity for the control modal, including linking table clicks and navigation back to the main view.
- Return type:
None
- layout()¶
Generates the layout for the control modal.
- Returns:
Layout containing the control modal and interactive components.
- Return type:
dash.html.Div
ssb_dash_framework.modals.hb_method module¶
- class HBMethod(database, hb_get_data_func, selected_state_keys, selected_ident, variable)¶
Bases:
object
Module for detecting outliers using the Hidiroglou-Berthelot (HB) method in a Dash application.
This module applies the HB method to identify potential outliers in time-series data by comparing values in the current period (t) with revised values from the previous period (t-1). It includes methods for preprocessing data, visualizing results, and managing interactions in a Dash app.
- Parameters:
database (object)
hb_get_data_func (Callable[[...], DataFrame])
selected_state_keys (list[str])
selected_ident (str)
variable (str)
- database¶
Database connection or interface for fetching data.
- Type:
object
- hb_get_data¶
Function for retrieving data based on selected parameters.
- Type:
callable
References
More information about the HB method: https://rdrr.io/github/statisticsnorway/Kostra/man/Hb.html
- callbacks()¶
Registers callbacks for the HB method Dash app components.
- Return type:
None
Notes
This method registers Dash callbacks for handling user interactions, including running the HB method, toggling the modal, and passing results to variabelvelger.
- layout()¶
Generates the layout for the HB method Dash component.
- Returns:
Div containing the modal and interactive elements for the HB method.
- Return type:
dash.html.Div
- make_hb_data(data_df, pc, pu, pa, ident, variable)¶
Processes data using the HB method for outlier detection.
- Parameters:
data_df (pandas.DataFrame) – Input data containing variables for analysis.
pc (int) – Confidence interval control parameter.
pu (float) – Parameter for adjusting the variable’s level.
pa (float) – Parameter for small differences between quartiles and the median.
ident (str) – Identifier field name in the dataset.
variable (str) – Name of the value variable for analysis.
- Returns:
Processed data with outlier results, sorted by “maxX”.
- Return type:
pandas.DataFrame
- make_hb_figure(data)¶
Creates a Plotly figure for visualizing HB method results.
- Parameters:
data (pandas.DataFrame) – Processed data from the HB method, including outlier and limit values.
- Returns:
Plotly figure with scatter plots for observations and limits.
- Return type:
plotly.graph_objects.Figure
ssb_dash_framework.modals.visualizationbuilder module¶
- class VisualizationBuilder(database)¶
Bases:
object
A module for creating and visualizing data queries and graphs interactively.
- Parameters:
database (object)
- database¶
The database connection or interface for executing queries.
- Type:
object
- callbacks()¶
Registers Dash callbacks for the Visualiseringsbygger module.
- Return type:
None
Notes
sqlmodal_toggle: Toggles the visibility of the query modal.
sql_query: Executes the SQL query and updates the table and dropdown options.
update_graph: Generates graphs based on selected columns and graph type.
- layout()¶
Generates the layout for the Visualiseringsbygger module.
- Returns:
A Div element containing components for querying data and visualizing graphs.
- Return type:
html.Div