ssb_sirius_dash.tabs package

ssb_sirius_dash.tabs.aarsregnskap module

class Aarsregnskap

Bases: object

Tab for displaying annual financial statements (Årsregnskap).

label

Label for the tab, displayed as “🧾 Årsregnskap”.

Type:

str

callbacks()

Register Dash callbacks for the Årsregnskap tab.

Return type:

None

layout()

Generate the layout for the Årsregnskap tab.

Returns:

A Div element containing input fields for year and organization number

and an iframe to display the PDF content.

Return type:

html.Div

ssb_sirius_dash.tabs.bofregistry module

class BofInformation

Bases: object

Tab for displaying and managing information from BoF.

This component: - Displays detailed information about selected foretak using cards. - Provides a table for associated business data. - Interacts with a DuckDB in-memory database to fetch data.

database

In-memory database connection for querying BoF foretak data.

Type:

duckdb.DuckDBPyConnection

label

Label for the tab, displayed as “🗃️ BoF Foretak”.

Type:

str

generate_card(title, component_id, var_type)

Generates a Dash Bootstrap card for displaying information.

Parameters:
  • title (str)

  • component_id (str)

  • var_type (str)

Return type:

Card

register_table()

Registers the BoF foretak data as a table in DuckDB.

Return type:

DuckDBPyConnection

layout()

Generates the layout for the BoF Foretak tab.

Return type:

Div

callbacks()

Registers Dash callbacks for handling user interactions.

Return type:

None

callbacks()

Register Dash callbacks for the BoF Foretak tab.

Return type:

None

Notes

  • The bof_data callback fetches and updates data in the cards based on the selected foretak.

generate_card(title, component_id, var_type)

Generate a Dash Bootstrap card for displaying data.

Parameters:
  • title (str) – Title displayed in the card header.

  • component_id (str) – ID assigned to the input component inside the card.

  • var_type (str) – Input type for the component (e.g., “text”).

Returns:

A styled card containing an input field.

Return type:

dbc.Card

layout()

Generate the layout for the BoF Foretak tab.

Returns:

A Div element containing:
  • Cards displaying detailed information about foretak.

Return type:

html.Div

register_table()

Register the BoF foretak data as a DuckDB table.

Returns:

A connection to an in-memory DuckDB instance with the BoF foretak data registered.

Return type:

duckdb.DuckDBPyConnection

Raises:
  • PermissionError – If user does not have access to the BoF registry.

  • OSError – If another error occurs when trying to read data from the BoF registry.

Notes

This function will need refactoring when a more permanent data storage for BoF is established.

ssb_sirius_dash.tabs.freesearch module

class FreeSearch(database)

Bases: object

Tab for free-text SQL queries and displaying results in an AgGrid table.

This class provides a layout for a tab that allows users to: - Enter SQL queries in a text area. - Optionally specify partition filters as a dictionary string. - Display the query results in an editable Dash AgGrid table.

Parameters:

database (object)

database

Database connection or interface for executing SQL queries.

Type:

object

label

Label for the tab, displayed in the application.

Type:

str

layout()

Generates the layout for the tab.

Return type:

Div

callbacks()

Registers the Dash callbacks for interactivity.

Return type:

None

callbacks()

Register the Dash callbacks for the FrisokTab.

Return type:

None

Notes

  • This method registers a callback for executing the SQL query when the “kjør” button is clicked.

  • The results are displayed in the AgGrid table, with appropriate column definitions.

layout()

Generate the layout for the FrisokTab.

Returns:

A Div element containing the text area for SQL queries,

input for partitions, a button to run the query, and a Dash AgGrid table for displaying results.

Return type:

html.Div

ssb_sirius_dash.tabs.generic module

class EditingTable(label, database, tables, var_input, states, get_data_func, update_table_func)

Bases: object

A component for editing database tables using a Dash AgGrid table.

This class provides a layout and functionality to: - Select a database table from a dropdown menu. - Load data into an editable Dash AgGrid table. - Update database values based on user edits in the table.

Parameters:
  • label (str)

  • database (object)

  • tables (list[str])

  • var_input (str)

  • states (list[str])

  • get_data_func (Callable[[...], Any])

  • update_table_func (Callable[[...], Any])

label

The label for the tab or component.

Type:

str

database

Database connection or interface for querying and updating data.

Type:

object

tables

List of available table names for selection.

Type:

list[str]

var_input

Variable input key for identifying records in the database.

Type:

str

states

Keys representing dynamic states to filter data.

Type:

list[str]

get_data

Function to fetch data from the database.

Type:

callable

update_table

Function to update database records based on edits in the table.

Type:

callable

dropdown_options

List of options for the dropdown menu, derived from tables.

Type:

list[dict]

callbacks()

Register Dash callbacks for the EditingTable component.

Return type:

None

Notes

  • The load_ag_grid callback loads data into the table based on the selected table and filter states.

  • The update_table callback updates database values when a cell value is changed.

layout()

Generate the layout for the EditingTable component.

Returns:

A Div element containing:
  • A dropdown menu to select a database table.

  • An editable Dash AgGrid table for displaying and modifying data.

  • A status message for updates.

Return type:

html.Div

ssb_sirius_dash.tabs.pi_memorizer module

class Pimemorizer

Bases: object

A tab for testing and improving memory of the digits of π (Pi).

This component provides: - A text box to display the digits entered so far. - A numeric keypad to input digits. - A scoring system to track the current and high scores.

label

The label for the tab, set to “𝝅 Pi memorizer”.

Type:

str

layout()

Generates the layout for the Pi memorizer tab.

Return type:

Div

callbacks()

Registers the Dash callbacks for handling user interactions.

Return type:

None

callbacks()

Register Dash callbacks for the Pi memorizer tab.

Return type:

None

Notes

  • The update_input callback handles the interaction between the numeric keypad and the current sequence, score, and high score.

layout()

Generate the layout for the Pi memorizer tab.

Returns:

A Div element containing:
  • A text area to display the user’s current input sequence.

  • A numeric keypad for entering digits.

  • Score and high score displays to track progress.

Return type:

html.Div