def build_ui(cls):
        """
        Describe the Azure ServiceBus connectivity
        """
        from iotfunctions import ui

        # define arguments that behave as function inputs
        inputs = [
            ui.UISingle(required=True,
                        datatype=str,
                        name='EndPoint',
                        description='Azure EndPoint'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='SharedAccessKeyName',
                        description='Azure SharedAccessKeyName'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='SharedAccessKey',
                        description='Azure SharedAccessKey'),
            ui.UISingle(required=True,
                        datatype=int,
                        name='EntityPath',
                        description='Azure EntityPath'),
        ]

        # define arguments that behave as function outputs
        outputs = [ui.UIStatusFlag(name='sb_preload_ok')]
        return (inputs, outputs)
Example #2
0
    def build_ui(cls):
        """
        Describe the sklearn model and target column
        """

        # define arguments that behave as function inputs
        inputs = [
            ui.UISingle(required=True,
                        datatype=str,
                        name='model_path',
                        description='Path of sklearn pickle file'),
            ui.UIMultiItem(
                required=True,
                datatype=str,
                name='dependent_variables',
                description=
                "Columns to provide to the model's predict() function")
        ]

        # define arguments that behave as function outputs
        outputs = [
            ui.UISingle(required=True,
                        datatype=str,
                        name='predicted_value',
                        description='Name of the predicted column')
        ]
        return (inputs, outputs)
Example #3
0
    def build_ui(cls):
        #define arguments that behave as function inputs
        inputs = []
        inputs.append(
            ui.UIMultiItem(
                name='input_items',
                datatype=float,
                description="Data items adjust",
                # output_item = 'output_item',
                is_output_datatype_derived=True))
        inputs.append(
            ui.UISingle(
                name='wml_endpoint',
                datatype=str,
                description='Endpoint to WML service where model is hosted',
                tags=['TEXT'],
                required=True))
        inputs.append(
            ui.UISingle(name='deployment_id',
                        datatype=str,
                        description='Deployment ID for WML model',
                        tags=['TEXT'],
                        required=True))
        inputs.append(
            ui.UISingle(name='apikey',
                        datatype=str,
                        description='IBM Cloud API Key',
                        tags=['TEXT'],
                        required=True))

        outputs = []
        outputs.append(ui.UISingle(name='output_item', datatype=float))
        return (inputs, outputs)
Example #4
0
 def build_ui(cls):
     '''
     Registration metadata
     '''
     # define arguments that behave as function inputs
     inputs = []
     inputs.append(
         ui.UISingle(name='request',
                     datatype=str,
                     description='comma separated list of entity ids',
                     values=['GET', 'POST', 'PUT', 'DELETE']))
     inputs.append(
         ui.UISingle(name='url',
                     datatype=str,
                     description='request url',
                     tags=['TEXT'],
                     required=True))
     inputs.append(
         ui.UISingle(name='headers',
                     datatype=dict,
                     description='request url',
                     required=False))
     inputs.append(
         ui.UISingle(name='body',
                     datatype=dict,
                     description='request body',
                     required=False))
     # define arguments that behave as function outputs
     outputs = []
     outputs.append(ui.UIStatusFlag(name='output_item'))
     return (inputs, outputs)
    def build_ui(cls):
        #define arguments that behave as function inputs
        inputs = []
        inputs.append(
            ui.UIMultiItem(
                name='input_items',
                datatype=float,
                description="Data items adjust",
                # output_item = 'output_item',
                is_output_datatype_derived=True))
        # inputs.append(ui.UISingle(name='input_columns',
        #                       datatype=str,
        #                       description='Features to load from entity rows. Provide as list of comma seperated values like so - torque,speed,pressure',
        #                       tags=['TEXT'],
        #                       required=True
        #                       ))

        inputs.append(
            ui.UISingle(
                name='wml_endpoint',
                datatype=str,
                description='Endpoint to WML service where model is hosted',
                tags=['TEXT'],
                required=True))
        inputs.append(
            ui.UISingle(name='instance_id',
                        datatype=str,
                        description='Instance ID for WML model',
                        tags=['TEXT'],
                        required=True))
        inputs.append(
            ui.UISingle(name='deployment_id',
                        datatype=str,
                        description='Deployment ID for WML model',
                        tags=['TEXT'],
                        required=True))
        inputs.append(
            ui.UISingle(name='apikey',
                        datatype=str,
                        description='IBM Cloud API Key',
                        tags=['TEXT'],
                        required=True))
        # define arguments that behave as function outputs
        outputs = []
        outputs.append(ui.UISingle(name='output_items', datatype=float))
        return (inputs, outputs)

        outputs = []
        return (inputs, outputs)
    def build_ui(cls):
        #define arguments that behave as function inputs
        inputs = []
        inputs.append(
            ui.UIMultiItem(name='features',
                           datatype=float,
                           description="Data items to use as features"))
        inputs.append(
            ui.UIMultiItem(name='targets',
                           datatype=float,
                           description="Data items to use as targets"))
        inputs.append(ui.UISingle(name='threshold', datatype=float))
        outputs = []
        outputs.append(
            ui.UIFunctionOutMulti(name='predictions',
                                  datatype=float,
                                  cardinality_from='targets',
                                  description='Output predictions'))
        outputs.append(
            ui.UIFunctionOutMulti(name='alerts',
                                  datatype=bool,
                                  cardinality_from='targets',
                                  description='Alert outputs'))

        return (inputs, outputs)
    def build_ui(cls):
        """
        Describe the Azure IoT connectivity
        """
        from iotfunctions import ui

        # define arguments that behave as function inputs
        inputs = [
            ui.UISingle(required=True,
                        datatype=str,
                        name='iot_hub_name',
                        description='Azure IoT Hub Name'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='policy_name',
                        description='Azure IoT Policy'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='consumer_group',
                        description='Azure IoT Consumer Group'),
            ui.UISingle(required=True,
                        datatype=int,
                        name='partition_id',
                        description='Azure IoT Partition ID'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='access_key',
                        description='Azure IoT Secret Access Key'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='device_id',
                        description='Azure IoT Device ID'),
            ui.UISingle(
                required=True,
                datatype=str,
                name='date_field',
                description=
                'Field in the incoming JSON for event date (timestamp)',
                default='date'),
            ui.UISingle(
                required=True,
                datatype=str,
                name='required_fields',
                description=
                'Fields in the incoming JSON that are required for the payload to be retained'
            ),
        ]

        # define arguments that behave as function outputs
        outputs = [ui.UIStatusFlag(name='amqp_preload_ok')]
        return (inputs, outputs)
 def build_ui(cls):
     """
     Registration metadata
     """
     # define arguments that behave as function inputs
     inputs = []
     inputs.append(
         ui.UISingle(name='csv_file',
                     datatype=str,
                     description='CSV File pattern (*.csv)',
                     tags=['TEXT'],
                     required=True))
     inputs.append(
         ui.UISingle(name='rebaseTS',
                     datatype=bool,
                     description='Rebase timestamps',
                     required=True))
     # define arguments that behave as function outputs
     outputs = []
     outputs.append(ui.UIStatusFlag(name='output_item'))
     return (inputs, outputs)
Example #9
0
 def build_ui(cls):
     #define arguments that behave as function inputs
     inputs = []
     inputs.append(
         ui.UIMultiItem(name='input_items',
                        datatype=float,
                        description="Data items adjust",
                        output_item='output_items',
                        is_output_datatype_derived=True))
     inputs.append(ui.UISingle(name='factor', datatype=float))
     outputs = []
     return (inputs, outputs)
Example #10
0
    def build_ui(cls):

        # Your function will UI built automatically for configuring it
        # This method describes the contents of the dialog that will be built
        # Account for each argument - specifying it as a ui object in the "inputs" or "outputs" list

        inputs = [
            ui.UISingle(
                name='name',
                datatype=str,
                description='Name of person to greet'),
            ui.UISingle(
                name='token',
                datatype=str,
                description='install token')
        ]
        outputs = [
            ui.UIFunctionOutSingle(
                name='output_col',
                datatype=str,
                description='Output item produced by function')
        ]
        return (inputs, outputs)
Example #11
0
 def build_ui(cls):
     #define arguments that behave as function inputs
     inputs = []
     inputs.append(
         ui.UISingleItem(name='input_item',
                         datatype=float,
                         description='Column for feature extraction'))
     inputs.append(
         ui.UISingle(
             name='windowsize',
             datatype=int,
             description='Window size for spectral analysis - default 24'))
     inputs.append(
         ui.UISingle(name='zscore',
                     datatype=float,
                     description='Zscore to be interpreted as anomaly'))
     #define arguments that behave as function outputs
     outputs = []
     outputs.append(
         ui.UIFunctionOutSingle(name='output_item',
                                datatype=float,
                                description='zscore'))
     return (inputs, outputs)
Example #12
0
    def build_ui(cls):
        # define arguments that behave as function inputs
        from iotfunctions import ui
        inputs = [
            ui.UISingle(
                name='source_entity_type_name',
                datatype=str,
                description=
                "Name of the entity type that you would like to retrieve data from"
            ),
            ui.UISingle(name='ts_interval',
                        datatype=int,
                        description="Timestamp fill Interval in seconds"),
            ui.UISingle(
                name='ts_lapse',
                datatype=int,
                description=
                "Timestamp lapse in seconds, how far to look in the past for records"
            )
        ]

        # define arguments that behave as function outputs
        outputs = [ui.UIStatusFlag(name='extend_entity_ok')]
        return (inputs, outputs)
Example #13
0
    def build_ui(cls):
        """
        Describe the OSIPi Server connectivity
        """
        from iotfunctions import ui

        # define arguments that behave as function inputs
        inputs = [
            ui.UISingle(required=True,
                        datatype=str,
                        name='osipi_host',
                        description='OSIPi server hostname'),
            ui.UISingle(required=True,
                        datatype=int,
                        name='osipi_port',
                        description='OSIPi server host port'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='osipi_user',
                        description='OSIPi server userid'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='osipi_pass',
                        description='OSIPi server password'),
            ui.UISingle(
                required=True,
                datatype=str,
                name='date_field',
                description=
                'Field in the incoming JSON for event date (timestamp)',
                default='date'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='parent_element_path',
                        description='OSIPi Parent Element Path'),
            ui.UISingle(
                required=True,
                datatype=str,
                name='interval',
                description=
                'Interpolation interval e.g. 10s, 1h, or blank for recorded data only'
            )
        ]

        # define arguments that behave as function outputs
        outputs = [ui.UIStatusFlag(name='osipi_elements_preload_ok')]
        return (inputs, outputs)
    def build_ui(cls):
        '''
        Registration metadata
        '''
        #define arguments that behave as function inputs
        inputs = []
        inputs.append(
            ui.UISingle(name='dummy_input',
                        datatype=str,
                        description='Any input'))
        #define arguments that behave as function outputs
        outputs = []
        outputs.append(
            ui.UIFunctionOutSingle(
                name='output_item',
                datatype=bool,
                description='Returns a status flag of True when executed'))

        return (inputs, outputs)
Example #15
0
 def build_ui(cls):
     # define arguments that behave as function inputs
     inputs = []
     inputs.append(
         ui.UISingleItem(name='status_input_item',
                         datatype=None,
                         description='Item name to use for status'))
     inputs.append(
         ui.UISingle(
             name='include_only',
             datatype=str,
             description='Filter to include only rows with a status of this'
         ))
     # define arguments that behave as function outputs
     outputs = []
     outputs.append(
         ui.UIFunctionOutSingle(
             name='output_item',
             datatype=bool,
             description=
             'Item that contains the execution status of this function'))
     return (inputs, outputs)
Example #16
0
 def build_ui(cls):
     #define arguments that behave as function inputs
     inputs = []
     inputs.append(
         ui.UISingle(name='nr_centroids',
                     datatype=int,
                     description='Number of centroids'))
     inputs.append(
         ui.UISingleItem(name='input_item_1',
                         datatype=float,
                         description='First column for correlation'))
     inputs.append(
         ui.UISingleItem(name='input_item_2',
                         datatype=float,
                         description='Second column for correlation'))
     #define arguments that behave as function outputs
     outputs = []
     outputs.append(
         ui.UIFunctionOutSingle(name='label',
                                datatype=int,
                                description='K-Means label'))
     return (inputs, outputs)
    def build_ui(cls):

        # define arguments that behave as function inputs
        inputs = [
            ui.UIMultiItem(name='features',
                           datatype=float,
                           description='Predictive features'),
            ui.UISingle(
                name='saved_model_name',
                datatype=str,
                description='Name of the model to use with '
                'this forecaster. This model will be retrieved from model store'
            )
        ]

        # define arguments that behave as function outputs
        outputs = [
            ui.UIFunctionOutSingle(name='target',
                                   datatype=float,
                                   description='Predicted output')
        ]
        return inputs, outputs
Example #18
0
def parse_input_constants(constants):
    """
    generate sqlalchemy Column from user defined columns (for UISingle constants only)
    TODO: add support for UIMulti. Currently, it's not documented how to

    :param constants: list of dicts; example:
    ```
    [{
        'name': 'sample_constant_name',
        'datatype' : 'number',
        'default': 0.3,
        'description': 'optional'
        # accepted datatypes: 'str'/'string, 'int'/'integer', 'number'/'float','datetime', 'bool'/'boolean'
    }]
    ```
    :return: ui_control constants accepted BasicCustomEntity
    """
    ret_constants = []

    for c in constants:
        datatype, default, description = None, None, None
        if 'datatype' in c:
            datatype = python_type(c['datatype'])
        if 'default' in c:
            default = c['default']
        if 'description' in c:
            description = c['description']

        if datatype is not None and default is not None and c[
                'datatype'] == 'datetime':
            default = validate_and_normalize_timestamp(default)

        ret_constants.append(
            ui.UISingle(name=c['name'],
                        description=description,
                        datatype=datatype,
                        default=default))

    return ret_constants
Example #19
0
    def build_ui(cls):
        """
        Describe the OSIPi Server connectivity
        """
        from iotfunctions import ui

        # define arguments that behave as function inputs
        inputs = [
            ui.UISingle(required=True,
                        datatype=str,
                        name='osipi_host',
                        description='OSIPi server hostname'),
            ui.UISingle(required=True,
                        datatype=int,
                        name='osipi_port',
                        description='OSIPi server host port'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='osipi_user',
                        description='OSIPi server userid'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='osipi_pass',
                        description='OSIPi server password'),
            ui.UISingle(required=True,
                        datatype=str,
                        name='name_filter',
                        description='OSIPi Point name filter'),
            ui.UIParameters(
                required=True,
                name='points_attr_map',
                description='OSIPi Points names to attribute names map'),
            ui.UISingle(
                required=True,
                datatype=str,
                name='date_field',
                description=
                'Field in the incoming JSON for event date (timestamp)',
                default='date'),
            # ui.UISingle(required=True, datatype=str, name='required_fields', description='Fields in the incoming JSON that are required for the payload to be retained'),
        ]

        # define arguments that behave as function outputs
        outputs = [ui.UIStatusFlag(name='osipi_preload_ok')]
        return (inputs, outputs)
Example #20
0
    def build_ui(cls):
        """
        Registration metadata
        """
        # define arguments that behave as function inputs
        inputs = []
        inputs.append(
            ui.UISingleItem(name='date_1',
                            datatype=dt.datetime,
                            required=False,
                            description=('Date data item. Use timestamp'
                                         ' if no date specified')))
        inputs.append(
            ui.UISingle(name='ref_date',
                        datatype=dt.datetime,
                        description='Date value'))
        # define arguments that behave as function outputs
        outputs = []
        outputs.append(
            ui.UIFunctionOutSingle(name='num_days',
                                   datatype=float,
                                   description='Number of days'))

        return (inputs, outputs)
 def build_ui(cls):
     '''
     Registration metadata
     '''
     # define arguments that behave as function inputs
     inputs = []
     inputs.append(ui.UISingle(name='username',
                           datatype=str,
                           description='Username for Building Insignts Instance',
                           tags=['TEXT'],
                           required=True
                           ))
     inputs.append(ui.UISingle(name='password',
                           datatype=str,
                           description='Password for Building Insignts Instance',
                           tags=['TEXT'],
                           required=True
                           ))
     inputs.append(ui.UISingle(name='request',
                           datatype=str,
                           description='HTTP Request type',
                           values=['GET','POST','PUT','DELETE']
                           ))
     inputs.append(ui.UISingle(name='url',
                               datatype=str,
                               description='request url use internal_test',
                               tags=['TEXT'],
                               required=True
                               ))
     inputs.append(ui.UISingle(name='headers',
                            datatype=dict,
                            description='request url',
                            required = False
                            ))
     inputs.append(ui.UISingle(name='body',
                            datatype=dict,
                            description='request body',
                            required=False
                            ))
     # define arguments that behave as function outputs
     outputs=[]
     outputs.append(ui.UIStatusFlag(name='output_item'))
     return (inputs, outputs)