aisquared.config.rendering package

Submodules

aisquared.config.rendering.BarChartRendering module

class aisquared.config.rendering.BarChartRendering.BarChartRendering(label: str, id: str, chart_name: str, container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, display_legend: bool, legend_icon: str, labels_key: str | None = None, width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', labels: list | None = None, consolidate_rows: bool = True, css_params: dict | None = None)[source]

Bases: BaseObject

Rendering class for rendering a Bar Chart

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.BarChartRendering(
    'my_label',
    'my_id',
    'my_bar_chart',
    'my_container_id',
    'name',
    'value',
    'name_value',
    True,
    'circle'
)
>>> my_obj.to_dict()
{'className': 'BarChartRendering',
    'label': 'my_label',
    'params': {'id': 'my_id',
    'chartName': 'my_bar_chart',
    'containerId': 'my_container_id',
    'displayLegend': True,
    'legendIcon': 'circle',
    'width': 'auto',
    'height': 'auto',
    'xOffset': '0',
    'yOffset': '0',
    'datasource': [{'labels': None,
        'labelsKey': None,
        'consolidateRows': True,
        'predictionNameKey': 'name',
        'predictionValueKey': 'value',
        'predictionNameValue': 'name_value'}]}}
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.ChatRendering module

class aisquared.config.rendering.ChatRendering.ChatRendering(return_key, prediction_value_key=None, sender_name='You', responder_name='Chatbot')[source]

Bases: BaseObject

Rendering for a chatbot use case

property prediction_value_key
property responder_name
property return_key
property sender_name
to_dict()[source]

Get the configuration object as a dictionary

aisquared.config.rendering.ContainerRendering module

class aisquared.config.rendering.ContainerRendering.ContainerRendering(label: str, id: str, query_selector: str, position: str = 'absolute', static_position: str | None = None, width: str = 'auto', height: str = 'auto', display: str = 'flex', xOffset: str = '0', yOffset: str = '0', orientation: str = 'column', css_params: dict | None = None)[source]

Bases: BaseObject

Rendering for a container

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.ContainerRendering(
    'my container',
    'myContainerID',
    "[data-id='tabpanel-general']"
)
>>> my_obj.to_dict()
{'className': 'ContainerRendering',
'label': 'my container',
'params': {'id': 'myContainerID',
'width': 'auto',
'height': 'auto',
'display': 'flex',
'xOffset': '0',
'yOffset': '0',
'position': 'absolute',
'orientation': 'column',
'querySelector': "[data-id='tabpanel-general']",
'staticPosition': None}}
property display
property height
property id
property label
property orientation
property position
property query_selector
property static_position
to_dict() dict[source]

Get the configuration object as a dictionary

property width
property xOffset
property yOffset

aisquared.config.rendering.CustomRendering module

class aisquared.config.rendering.CustomRendering.CustomRendering(id: str, content_html: str, content_script: str, content_style: str, query_selector: str | None = None)[source]

Bases: BaseObject

property content_html
property content_script
property content_style
property id
property query_selector
to_dict()[source]

Get the object as a dictionary

aisquared.config.rendering.DashboardRendering module

THIS MODULE IS IN DEVELOPMENT AND NOT STABLE. PLEASE USE WITH CAUTION AND DO NOT USE FOR ANY PRODUCTION WORKLOADS

class aisquared.config.rendering.DashboardRendering.DashboardRendering[source]

Bases: BaseObject

THIS CLASS IS IN DEVELOPMENT AND IS NOT STABLE. PLEASE USE WITH CAUTION AND DO NOT USE FOR ANY PRODUCTION WORKLOADS

add_bar_chart(container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, chart_colors: list, chart_labels: list, width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', id: str | None = None, label: str | None = None, chart_name: str | None = None)[source]
add_container(query_selector: str, width: str = 'auto', height: str = 'auto', display: str = 'flex', xOffset: str = '0', yOffset: str = '0', position: str = '', orientation: str = 'column', id: str | None = None, label: str | None = None)[source]
add_doughnut_chart(container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, chart_colors: list, chart_labels: list, display_legend: bool = True, legend_icon: str = 'circle', width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', id: str | None = None, label: str | None = None, chart_name: str | None = None)[source]
add_html_tag(container_id: str, html_content: str, prediction_name_key: str = '', prediction_value_key: str = '', prediction_name_value: str = '', extra_content_tag: str = 'strong', injection_action: str = 'prepend', id: str | None = None, content: str = '', label: str | None = None)[source]
add_line_chart(container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, chart_colors: list, chart_labels: list, width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', id: str | None = None, label: str | None = None, chart_name: str | None = None)[source]
add_pie_chart(container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, chart_colors: list, chart_labels: list, display_legend: bool = True, legend_icon: str = 'circle', width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', id=None, label: str | None = None, chart_name: str | None = None)[source]
add_table(container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_values: str, table_name: str = '', id: str | None = None, label: str | None = None)[source]
property steps
to_dict()[source]

Get the object as a dictionary

aisquared.config.rendering.DashboardReplacementRendering module

class aisquared.config.rendering.DashboardReplacementRendering.DashboardReplacementRendering(anchor_selector: str, where_replace: str = '', label: str = '')[source]

Bases: BaseObject

Rendering for dashboard replacement

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.DashboardReplacementRendering(
    'test_anchor_selector'
)
>>> my_obj.to_dict()
{'className': 'DashboardReplacementRendering',
'label': '',
'params': {'anchorSelector': 'test_anchor_selector', 'whereReplace': ''}}
property anchor_selector
property label
to_dict() dict[source]

Get the configuration object as a dictionary

property where_replace

aisquared.config.rendering.DocumentRendering module

class aisquared.config.rendering.DocumentRendering.DocumentRendering(prediction_key: str = 'className', words: list | dict | str | None = None, documents: list | dict | str | None = None, include_probability: bool = False, probability_key: str = 'probability', underline_color: str = 'blue', classes: list | None = None, threshold_key: str | None = None, threshold_value: int | float | None = None)[source]

Bases: BaseObject

Object which dictates how to render predictions on entire documents

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.DocumentRendering()
>>> my_obj.to_dict()
{'className': 'DocumentRendering',
'params': {'predictionKey': 'className',
'words': None,
'documents': None,
'includeProbability': False,
'probabilityKey': 'probability',
'underlineColor': 'blue',
'classes': None,
'thresholdKey': None,
'thresholdValue': None}}
property classes
property documents
property include_probability
property prediction_key
property probability_key
property threshold_key
property threshold_value
to_dict() dict[source]

Get the configuration object as a dictionary

property underline_color
property words

aisquared.config.rendering.DoughnutChartRendering module

class aisquared.config.rendering.DoughnutChartRendering.DoughnutChartRendering(label: str, id: str, chart_name: str, container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, display_legend: bool, legend_icon: str, labels_key: str | None = None, width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', labels: list | None = None, consolidate_rows: bool = True, css_params: dict | None = None)[source]

Bases: BaseObject

Rendering class for rendering a Doughnut Chart

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.DoughnutChartRendering(
    'my_label',
    'my_id',
    'my_doughnut_chart',
    'my_container_id',
    'name',
    'value',
    'name_value',
    True,
    'circle'
)
>>> my_obj.to_dict()
{'className': 'DoughnutChartRendering',
'label': 'my_label',
'params': {'id': 'my_id',
'chartName': 'my_doughnut_chart',
'containerId': 'my_container_id',
'displayLegend': True,
'legendIcon': 'circle',
'width': 'auto',
'height': 'auto',
'xOffset': '0',
'yOffset': '0',
'datasource': [{'labels': None,
    'labelsKey': None,
    'consolidateRows': True,
    'predictionNameKey': 'name',
    'predictionValueKey': 'value',
    'predictionNameValue': 'name_value'}]}}
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.FilterRendering module

class aisquared.config.rendering.FilterRendering.FilterRendering(source: str, key: str, qualifier: str, value: list | str | int | float)[source]

Bases: BaseObject

Object which dictates how predictions are to be passed to downstream analytics

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.FilterRendering(
    'inputs',
    'key',
    'gt',
    0.2
)
>>> my_obj.to_dict()
{'className': 'FilterRendering',
'params': {'source': 'inputs', 'key': 'key', 'qualifier': 'gt', 'value': 0.2}}
property key
property qualifier
property source
to_dict() dict[source]

Get the configuration object as a dictionary

property value

aisquared.config.rendering.HTMLTagRendering module

class aisquared.config.rendering.HTMLTagRendering.HTMLTagRendering(label: str, id: str, container_id: str, html_content: str, extra_content_tag: str, injection_action: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, content: str = '', css_params: dict | None = None)[source]

Bases: BaseObject

Rendering for HTML tags

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.HTMLTagRendering(
    'my HTML tag',
    'MyHTMLTagRenderingID',
    'MyContainerID',
    '<p>Example Text</p>',
    'extra_tag',
    'append',
    'name_key',
    'value_key',
    'name_value'
)
>>> my_obj.to_dict()
{'className': 'HTMLTagRendering',
'label': 'my HTML tag',
'params': {'id': 'MyHTMLTagRenderingID',
'containerId': 'MyContainerID',
'htmlContent': '<p>Example Text</p>',
'extraContentTag': 'extra_tag',
'injectionAction': 'append',
'predictionNameKey': 'name_key',
'predictionValueKey': 'value_key',
'predictionNameValue': 'name_value',
'content': ''}}
to_dict() dict[source]

Return the configuration object as a dictionary

aisquared.config.rendering.ImageRendering module

class aisquared.config.rendering.ImageRendering.ImageRendering(color: str = 'blue', thickness: str = '5', placement: str = 'bottomleft', include_probability: bool = False, badge_color: str = 'white', font_color: str = 'black', font_size: str = '5', classes: list | None = None, threshold_key: str | None = None, threshold_value: int | float | None = None)[source]

Bases: BaseObject

Object which dictates how to render images

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.ImageRendering()
>>> my_obj.to_dict()
{'className': 'ImageRendering',
'params': {'color': 'blue',
'thickness': '5',
'placement': 'bottomleft',
'includeProbability': False,
'badgeColor': 'white',
'fontColor': 'black',
'fontSize': '5',
'classes': None,
'thresholdKey': None,
'thresholdValue': None}}
property badge_color
property classes
property color
property font_color
property font_size
property include_probability
property placement
property thickness
property threshold_key
property threshold_value
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.LineChartRendering module

class aisquared.config.rendering.LineChartRendering.LineChartRendering(label: str, id: str, chart_name: str, container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, display_legend: bool, legend_icon: str, labels_key: str, width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', labels: list | None = None, consolidate_rows: bool = True, css_params: dict | None = None)[source]

Bases: BaseObject

Rendering class for rendering a Line Chart

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.LineChartRendering(
    'my_label',
    'my_id',
    'my_line_chart',
    'my_container_id',
    'name',
    'value',
    'name_value',
    True,
    'circle',
    'labels'
)
>>> my_obj.to_dict()
{'className': 'LineChartRendering',
'label': 'my_label',
'params': {'id': 'my_id',
'chartName': 'my_line_chart',
'containerId': 'my_container_id',
'displayLegend': True,
'legendIcon': 'circle',
'width': 'auto',
'height': 'auto',
'xOffset': '0',
'yOffset': '0',
'datasource': [{'labels': None,
    'labelsKey': 'labels',
    'consolidateRows': True,
    'predictionNameKey': 'name',
    'predictionValueKey': 'value',
    'predictionNameValue': 'name_value'}]}}
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.ObjectRendering module

class aisquared.config.rendering.ObjectRendering.ObjectRendering(color: str = 'blue', thickness: str = '5', placement: str = 'bottomleft', include_probability: bool = False, badge_color: str = 'white', font_color: str = 'black', font_size: str = '5')[source]

Bases: BaseObject

Object which dictates how to render object detection in images

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.ObjectRendering()
>>> my_obj.to_dict()
{'className': 'ObjectRendering',
'params': {'color': 'blue',
'thickness': '5',
'placement': 'bottomleft',
'includeProbability': False,
'badgeColor': 'white',
'fontColor': 'black',
'fontSize': '5'}}
property badge_color
property color
property font_color
property font_size
property include_probability
property placement
property thickness
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.PieChartRendering module

class aisquared.config.rendering.PieChartRendering.PieChartRendering(label: str, id: str, chart_name: str, container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_value: str, display_legend: bool, legend_icon: str, labels_key: str | None = None, width: str = 'auto', height: str = 'auto', xOffset: str = '0', yOffset: str = '0', labels: list | None = None, consolidate_rows: bool = True, css_params: dict | None = None)[source]

Bases: BaseObject

Rendering class for rendering a Pie Chart

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.PieChartRendering(
        'my_label',
        'my_id',
        'my_doughnut_chart',
        'my_container_id',
        'name',
        'value',
        'name_value',
        True,
        'circle'
    )
>>> my_obj.to_dict()
{'className': 'PieChartRendering',
'label': 'my_label',
'params': {'id': 'my_id',
'chartName': 'my_doughnut_chart',
'containerId': 'my_container_id',
'displayLegend': True,
'legendIcon': 'circle',
'width': 'auto',
'height': 'auto',
'xOffset': '0',
'yOffset': '0',
'datasource': [{'labels': None,
    'labelsKey': None,
    'consolidateRows': True,
    'predictionNameKey': 'name',
    'predictionValueKey': 'value',
    'predictionNameValue': 'name_value'}]}}
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.SOSRendering module

class aisquared.config.rendering.SOSRendering.SOSRendering(can_toggle: bool, label: str = '')[source]

Bases: BaseObject

Rendering of an SOS dashboard

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.SOSRendering(True)
>>> my_obj.to_dict()
{'className': 'SOSRendering', 'label': '', 'params': {'canToggle': True}}
property can_toggle
property label
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.TableRendering module

class aisquared.config.rendering.TableRendering.TableRendering(label: str, id: str, container_id: str, prediction_name_key: str, prediction_value_key: str, prediction_name_values: str, table_name: str = '', css_params: dict | None = None)[source]

Bases: BaseObject

Class for rendering tables

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.TableRendering(
    'my table',
    'MyTableID',
    'MyContainerID',
    'name_key',
    'value_key',
    'name_values'
)
>>> my_obj.to_dict()
{'className': 'TableRendering',
'label': 'my table',
'params': {'id': 'MyTableID',
'containerId': 'MyContainerID',
'predictionNameKey': 'name_key',
'predictionValueKey': 'value_key',
'predictionNameValues': 'name_values',
'tableName': ''}}
to_dict() dict[source]

Get the configuration object as a dictionary

aisquared.config.rendering.TextRendering module

class aisquared.config.rendering.TextRendering.TextRendering(prediction_value_key: str | None = None)[source]

Bases: BaseObject

Class for rendering text

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.TextRendering(
    prediction_value_key = 'my_key'
)
>>> my_obj.to_dict()
{'className': 'TextRendering',
'params': {'predictionValueKey': 'my_key'}}
property prediction_value_key
to_dict()[source]

Get the object as a dictionary

aisquared.config.rendering.WordRendering module

class aisquared.config.rendering.WordRendering.WordRendering(word_list: str = 'input', result_key: str | None = None, content_key: str | None = None, badge_shape: str = 'star', badge_color: str = 'blue', classes: list | None = None, threshold_key: str | None = None, threshold_value: int | float | None = None, position: str = 'after')[source]

Bases: BaseObject

Object for rendering badges on individual words

Example usage:

>>> import aisquared
>>> my_obj = aisquared.config.rendering.WordRendering()
>>> my_obj.to_dict()
{'className': 'WordRendering',
'params': {'wordList': 'input',
'resultKey': None,
'contentKey': None,
'badgeShape': 'star',
'badgeColor': 'blue',
'classes': None,
'thresholdKey': None,
'thresholdValue': None
'position': 'after'}}
property badge_color
property badge_shape
property classes
property content_key
property position
property result_key
property threshold_key
property threshold_value
to_dict() dict[source]

Get the configuration object as a dictionary

property word_list

aisquared.config.rendering.utils module

aisquared.config.rendering.utils.save_default_css()[source]

Save default CSS so that default CSS can be edited and automatically utilized with changes

Notes

  • Saves all CSS files to the ~/.aisquared/ directory

Module contents

The aisquared.config.rendering subpackage contains objects for configuring how rendering of predictions is to occur.