nspek_dashboard module

class NspekDashboard(time_units, db_user=None)

Bases: ModuleBase

The Naeringsspesifikasjon module lets you view the nspek/naeringsspesifikasjon for a specified foretak (var-ident).

Parameters:
  • time_units (list[str])

  • db_user (str | None)

create_checkbox(component_id, label, value, checked=False)
Parameters:
  • component_id (str)

  • label (str)

  • value (str)

  • checked (bool)

create_development_figure(df)
Parameters:

df (DataFrame)

create_development_table(df)
Return type:

Div

Parameters:

df (DataFrame)

create_dialog(variant, title, message)
Parameters:
  • variant (str)

  • title (str)

  • message (str)

create_distribution_figure(df)
Parameters:

df (DataFrame)

create_distribution_table(df)
Return type:

Div

Parameters:

df (DataFrame)

create_dropdown_card(title, component_id, options=None, value=None)
Parameters:
  • title (str)

  • component_id (str)

create_info_card(title, component_id, var_type)
Parameters:
  • title (str)

  • component_id (str)

  • var_type (str)

create_key_figure(title, component_id, size='medium', icon=None, subtitle=None, time_text=None, time_id=None, glossary_text=None, green_box=False)

Create an SSB key figure component.

Return type:

Div

Parameters:
  • title (str)

  • component_id (str)

  • size (str)

  • icon (str | None)

  • subtitle (str | None)

  • time_text (str | None)

  • time_id (str | None)

  • glossary_text (str | None)

  • green_box (bool)

create_kpi_card(title, component_id, icon, description=None, card_id=None)

Create a dashboard KPI card using the SSB card component.

Return type:

Div

Parameters:
  • title (str)

  • component_id (str)

  • icon (str)

  • description (str | None)

  • card_id (str | None)

create_kpi_modal(modal_id, title, grid_id, column_defs, glossary_text=None)

Create a modal containing KPI information and an AG Grid.

Return type:

Modal

Parameters:
  • modal_id (str)

  • title (str)

  • grid_id (str)

  • column_defs (list[dict])

  • glossary_text (str | None)

create_mini_dialog(variant, title, orgnr, message)
Parameters:
  • variant (str)

  • title (str)

  • orgnr (str)

  • message (str)

layout()

Create the layout of the module itself, without tab/window wrapping.

module_callbacks()

Defines the callbacks for the Naeringsspesifikasjon module.

Return type:

None

construct_sequence(orgnr, aar)

Check for existing NSPEK registration and construct if needed.

Return type:

dict[str, str | int]

Parameters:
  • orgnr (str)

  • aar (int)

get_bof_database_path()

Find the available BOF database.

Return type:

Path

get_nspek_development_data(aar)

Return monthly NSPEK registration counts for the selected year.

Return type:

DataFrame

Parameters:

aar (int)

get_nspek_distribution_data(aar)

Return registration counts by virksomhetstype for the selected year.

Return type:

DataFrame

Parameters:

aar (int)

get_nspek_kpi_modal_data(aar, kilde=None, start_row=0, end_row=100, sort_model=None, filter_model=None)

Return one page of KPI modal rows and the total row count.

Return type:

tuple[DataFrame, int]

Parameters:
  • aar (int)

  • kilde (str | None)

  • start_row (int)

  • end_row (int)

  • sort_model (list[dict] | None)

  • filter_model (dict | None)

get_nspek_kpis(aar)

Return KPI values for NSPEK registrations.

Return type:

dict[str, int]

Parameters:

aar (int)

orgnr_exists_in_bof(orgnr)

Checks if organisation exists in BOF registry.

Example use: orgnr_exists_in_bof(“979443137”)

Return type:

bool

Parameters:

orgnr (str)