Back to bricks list
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

Dashboard

RESOURCE
Typing name :  RESOURCE.gws_core.StreamlitResource Brick :  gws_core

Streamlit dashboard app

Resource that contains a streamlit dashboard. See Streamlite agent to see how to generate it.

Views
DASHBOARDDefault view
Dahsboard generated with streamlit
VIEW RESOURCE
View the complete resource as json
RESOURCES LIST
List the resources
Attributes
flagged: boolname: strstyle: TypingStyletags: TagListtechnical_info: TechnicalInfoDictuid: str
Functions
__INIT__

Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters.

streamlit_app_code : str
ADD_MULTIPLE_RESOURCES
resources : List
_description_
message_dispatcher : MessageDispatcher
ADD_RESOURCE

Add a resource to the StreamlitResource.

resource : Any
_description_
create_new_resource : bool - True
_description_
ADD_TECHNICAL_INFO

Add technical information on the resource. Technical info are useful to set additional information on the resource.

technical_info : TechnicalInfo
technical information to add (key, value) this is a long description of the technical information
CHECK_RESOURCE

You can redefine this method to define custom logic to check this resource. If there is a problem with the resource, return a string that define the error, otherwise return None This method is called on output resources of a task. If there is an error returned, the task will be set to error and next proceses will not be run. It is also call when uploading a resource (usually for files or folder), if there is an error returned, the resource will not be uploaded

Return type : Optional
CLEAR
CLEAR_RESOURCES
CLONE

Clone the resource to create a new instance with a new id. It copies the RFields.

Return type : ResourceType
COPY_STREAMLIT_CODE_PATH

Set the streamlit code from a file path. The file will be read and the content will be copied as the streamlit code. Don't use this if you have multiple files for the streamlit app. In this case, use the set_streamlit_folder method. The code is stored as a string, the dashboard need to be re-generated to update the code.

streamlit_app_code_path : str
path to the streamlit code
COUNT
item : Any
Return type : int
GET_DEFAULT_NAME

You can redefine this method to set a name of the resource. When saving the resource the name will be saved automatically This can be useful to distinguish this resource from another one or to search for the resource

Return type : str
GET_DEFAULT_STYLE

Get the default style of the resource

Return type : TypingStyle
GET_MODEL_ID

Get the id of the resource model in the database. It is provided by the system for input resources of a task.

Return type : str
GET_NAME_OR_DEFAULT

Get the name of the resource or the default name if the name is None

Return type : str
GET_PARAMS

Get the parameters that will be passed to the streamlit app.

Return type : dict
GET_RESOURCE_BY_NAME

Return the first resource with the given name

Name : str
name of the resource
Return type : gws_core.resource.resource.Resource | None
GET_RESOURCE_MODEL_IDS

Return the resource model ids of the sub resources

Return type : Set
GET_RESOURCE_MODELS

Return the resource models of the sub resources list

Return type : List[ResourceModel]
GET_RESOURCES

Return the sub resources as a list

Return type : List
GET_RESOURCES_AS_SET

Return the sub resources as a set

Return type : Set
GET_STREAMLIT_APP_CODE

Get the streamlit code.

Return type : str
GET_TECHNICAL_INFO

Get the technical information of the resource

key : str
key of the technical information
Return type : TechnicalInfo
HAS_RESOURCE_MODEL

Return true if the resource with the given id is in the resource list

resource_model_id : str
id of the ResourceModel
Return type : bool
INDEX
item : Any
Return type : int
INIT

This can be overwritten to perform custom initialization of the resource. This method is called after the init (constructor) of the resource. The values of RFields are set when this method is called.

IS_EMPTY

Return true if the resource list is empty

Return type : bool
IS_VIRTUAL_ENV

Return True if the streamlit app is executed in a virtual environment.

Return type : bool
REPLACE_RESOURCES_BY_MODEL_ID

Replace current resources by the resources in the dict

resources : Dict
dict where key is the resource model id and value is the resource
REVERSE
SAVE_NEW_CHILDREN_RESOURCES
resource_origin : ResourceOrigin
scenario : Scenario
task_model : TaskModel
port_name : str
Return type : List[ResourceModel]
SET_DASHBOARD

Set the dashboard that will be used to generate the streamlit app. The Streamlit resource stores the dashboard typing name to find the dahsboard code. As long as the dashboard typing name does not change, the dashboard will be working.

If the dashboard code is updated, the SteamlitResource will automatically use the updated the dashboard code.

dashboard : Dashboard
dashboard object annotated with @dashboard_decorator and with get_folder_path method
SET_ENV_SHELL_PROXY

Set the code that will be executed in the streamlit environment. This code is executed before the streamlit app is loaded and can be used to load environment variables.

shell_proxy : BaseEnvShell
SET_PARAM

Set a parameter that will be passed to the streamlit app into the 'params' variable.

key : str
key of the parameter
value : Any
value of the parameter (must be serializable to json)
SET_PARAMS

Set the parameters that will be passed to the streamlit app into the 'params' variable.

params : dict
parameters
SET_STREAMLIT_CODE

Set the streamlit code dynamically. The code is stored as a string, the dashboard need to be re-generated to update the code.

streamlit_code : str
streamlit code
SET_STREAMLIT_FOLDER

Set the folder that contains the streamlit code. The folder must contain a main.py file.

This is only recommended if you want to force the version of the dashboard in this Resource and avoid automatic updates. Otherwise use the set_dashboard method. The folder is copied and stored as a sub resource of the StreamlitResource. The dashboard need to be re-generated to update the code.

streamlit_app_folder_path : str
SORT
key : Any
reverse : bool - False
TO_LIST

Return the resources as a list

Return type : List
CLASSNAME - @classmethod

Returns the name of the class

slugify : bool - False
True to slugify the class name if True
snakefy : bool - False
True to snakefy the class name if True
replace_uppercase : bool - False
Replace upper cases by "-" if True
Return type : str
COPY_STYLE - @classmethod

Copy the style of the resource with the possibility to override some properties. Useful when settings the style for a task based on the resource style.

Icon technical name : str
technical name of the icon if provided, the icon_type must also be provided
Icon type : TypingIconType
type of the icon if provided, the icon_technical_name must also be provided
background_color : str
background color
icon_color : TypingIconColor
icon color
Return type : TypingStyle
FULL_CLASSNAME - @classmethod

Returns the full name of the class

slugify : bool - False
Slugify the returned class name if True
snakefy : bool - False
Snakefy the returned class name if True
Return type : str
GET_HUMAN_NAME - @classmethod

Get the human name of the resource

Return type : str
GET_SHORT_DESCRIPTION - @classmethod

Get the short description of the resource

Return type : str
GET_STYLE - @classmethod

Get the style of the resource

Return type : TypingStyle
GET_TYPING_NAME - @classmethod

Get the typing name of the resource

Return type : str
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type : List
MIGRATE_STREAMLIT_RESOURCES - @classmethod

method to migrate streamlit resources to use the dashboard class

Args: task_typing_name (str): typing name of the task that generated the SteamlitResource

task_typing_name : str
dashboard_typing_name : str
FROM_CODE_PATH - @staticmethod

Create a StreamlitResource from a file path. The file will be read and the content will be set as the streamlit code. Don't use this if you have multiple files for the streamlit app. In this case, use the set_streamlit_folder method.

streamlit_app_code_path : str
_description_
Return type : StreamlitResource