Form

Components

Contains utilities for form components.

This module is composed of various utilities for form components. These include common components and components that are specific to a given page.

deeprootgen.form.components.build_calibration_parameters(form_name: str, task: str, parameter_values: list, calibration_values: list, observed_data: list[dict] | None = None, summary_statistics: list[dict] | None = None, observed_data_content: str = '', raw_edge_content: str = '', stat_by_layer: bool = False, stat_by_col: bool = False, use_summary_statistics: bool = True) dict | None[source]

Build calibration parameters for workflow submission from form inputs.

Args:
form_name (str):

The name of the current form.

task (str):

The current simulation task.

parameter_values (list):

The parameter form input data.

calibration_values (list):

The calibration parameter form input data.

observed_data: (list[dict] | None, optional):

The list of observed root data. Defaults to None.

summary_statistics: (list[dict] | None, optional):

The list of observed summary statistic data. Defaults to None.

observed_data_content (str, optional):

The raw content string for the observed root data. Defaults to “”.

raw_edge_content (str, optional):

The raw content string for the simulated edge data. Defaults to “”.

stat_by_layer (bool, optional):

Whether to calculate statistics by soil layer. Defaults to False.

stat_by_col (bool, optional):

Whether to calculate statistics by soil column. Defaults to False.

use_summary_statistics (bool, optional):

Whether to use summary statistics rather than graph data. Defaults to True.

Returns:
dict | None:

The calibration parameters for workflow submission

deeprootgen.form.components.build_collapsible(components: list, page_id: str, label: str) Row[source]

Build a collapsible form element.

Args:
components (list):

A list of form components.

page_id (str):

The ID of the current page for grouping components.

label (str):

The label for the collapsible.

Returns:

dbc.Row: The collapsible.

deeprootgen.form.components.build_common_components(component_specs: list, page_id: str, component_type: str, component_data: dict | None = None, resize_component: bool = True) list[source]

Build form components that are common across pages.

Args:
component_specs (list):

The list of form component specifications.

page_id (str):

The page ID.

component_type (str):

The type of component. Used for grouping common components.

component_data: (dict, optional):

A dictionary of data to render within form component.

resize_component: (bool, optional):

Whether to resize the last component in the row.

Returns:

list: The common form components.

deeprootgen.form.components.build_common_layout(title: str, page_id: str, input_components: list, output_components: list, layout_description: str, left_sticky: bool = False, right_sticky: bool = True) Div[source]

Build a common form layout for interacting with the root model.

Args:
title (str):

The page title.

page_id (str):

The page ID.

input_components (list):

The list of input form components.

output_components (list):

The list of modelling output components.

layout_description (str):

A description of the layout to add as page tooltip.

left_sticky (bool, optional):

Whether the left side of the page should be sticky. Defaults to False.

right_sticky (bool, optional):

Whether the right side of the page should be sticky. Defaults to True.

Returns:
html.Div:

The common layout.

deeprootgen.form.components.get_common_layout(title: str, page_id: str, page_description: str, parameter_form_name: str = 'simulation_form', simulation_form_name: str = 'simulation_form', procedure: str = 'Simulation', task: str = 'simulation', data_key: str = 'summary_data', left_sticky: bool = False, right_sticky: bool = True) Div[source]

Get the common form layout for multiple dashboard pages.

Args:
title (str):

The page title.

page_id (str):

The current page ID.

page_description (str):

A description of the page.

parameter_form_name (str, optional):

The name of the parameter form components specification. Defaults to “simulation_form”.

simulation_form_name (str, optional):

The name of the simulation form components specification. Defaults to “simulation_form”.

procedure (str):

The simulation procedure.

task (str):

The simulation task.

data_key (str):

The key to use for building the data components within the form.

left_sticky (bool, optional):

Whether the left side of the page should be sticky. Defaults to False.

right_sticky (bool, optional):

Whether the right side of the page should be sticky. Defaults to True.

Returns:
html.Div:

The common layout.

Get a list of model calibration deployment links.

Returns:
list[dbc.NavItem]:

The list of model calibration deployment links.

Get the list of external links.

Returns:
dbc.Nav:

The navigation component for the external links.

deeprootgen.form.components.get_out_table_df() DataFrame[source]

Get the default output table as a dataframe.

Returns:
pd.DataFrame:

The output table as a dataframe.