Building a Design Advisor

This example demonstrates how to build a simple advisor for Formulation Design that highlights a formula when it exceeds a specified number of ingredients.

Note: For more information about the app, see 3D Modeling | Laboratory Informatics | Design Advisor.

This task shows you how to:

Create and Configure a Pipeline

Before you begin:
  1. Start a new pipeline using the Virtual Advisor template. For more information, see Creating a Pipeline Overview.
  2. If you plan to build an advisor that requires input, follow the Enable Configuration steps to enable and define a configuration form. Otherwise, continue with Build the Advisor Report.

Enable Configuration

The optional Advisor Configuration subpipeline creates a form to capture input for the advisor.

Context: The form created in this example includes a single field to specify the threshold for a large amount, and defines the default value for when no threshold is provided. If you do not need a form, continue with Build the Advisor Report.

  1. Click the work area to open the top-level parameters in the Parameters panel.
  2. Select the Requires Configuration parameter.
  3. Click to open the Advisor Configuration component.


  4. Add a component that specifies a default value for the form field:
    1. Add a Custom Manipulator (PilotScript) component.
    2. Right-click the component and select Toggle Ports > Remove - Input Port and Toggle Ports > Remove - Pass Port.
    3. Edit the caption of the component to indicate what it does. For this example, name it Create Default.
    4. From the Parameters panel, click next to the Expression parameter to open the script editor.
    5. Enter the following script in the editor to define a default value:

      If @vc_amount_limit Is Not Defined Then
          @vc_amount_limit := 500;
      End If;

  5. From the Catalog, add the WebUX Line Editor component without connecting to the custom manipulator.


  6. Configure the WebUX Line Editor component to create the form. In this example, create a single input field for a material limit. From the Parameters panel, edit the following parameters:
    ParameterValue
    Options > Parameter to Map vc_amount_limit
    Options > Default Value $(vc_amount_limit)
    Input Label > Text Material Limit (g)

    Design Advisor collects all parameters with a vc_ prefix. In this example, the Text parameter value, Material Limit (g), is the label for a field mapped to vc_amount_limit. When the advisor runs, the global variable @vc_amount_limit is set to the value specified by the user for this field.

    The following form is created when the advisor runs:



Build the Advisor Report

The Advisor Calculation subpipeline takes data records from the app, performs one or more calculations, and then generates a report.

Context: The advisor in this example generates a table of all materials above the weight limit, and another table with materials below the limit. The formulation weight is based on the targetQuantityWet property.

Tip: Make sure the units captured in your form match the value from the app (the targetQuantityWetUnit property in this example).

  1. Click to open the Advisor Calculation component.


  2. Select the Data Port component and add a Detatch Nodes component from the Catalog.

    You will use the Detach Nodes component to extract materials from the formulation data record.



  3. If you are creating an advisor for multiple formulations:
    1. Right-click the Detach Nodes component and choose Collapse to create a subpipeline. Name the subpipeline For each formulation.


    2. Select the subpipeline and specify the Run to Completion parameter as true.
  4. Configure the Detach Nodes component.
    1. Open the subpipeline if you are creating an advisor for multiple formulations.
    2. Select the Detach Nodes component.
    3. From the Parameters panel, click for the Select parameter.
    4. In the Select dialog box, enter //billOfMaterial.
    5. Click Save.
  5. Add a Custom Manipulator (PilotScript) component to Detatch Nodes and configure it:
    1. Select the Custom Manipulator (PilotScript) component.
    2. From the Parameters panel, click for the Expression parameter.
    3. Copy and paste the following script into the editor:

      // Tidy the property list to just those to be reported upon.
      Keep(‘name’, ‘targetQuantityWet’, ‘targetQuantityWetUnit’);
      If targetQuantityWet Is Defined Then
         // Gather the targetQuantityWetUnit; check in grams
         If targetQuantityWetUnit Is Defined And targetQuantityWetUnit Eq 'kg' Then
            targetQuantityWet *= 1000;
         End If;
      
         // Derive whether this material is over the limit or not. 
      
         over_limit := targetQuantityWet > @vc_amount_limit;
      
      End If;

    4. Click Save.
  6. Select the Custom Manipulator (PilotScript), and add a Custom Filter (PilotScript) component.

    This filter sends data records that exceed the limit to one table in the advisor report, and the others to a different table.



  7. Configure the Custom Filter (PilotScript) component:
    1. Select the Custom Filter (PilotScript) component.
    2. Enter over_limit Is Defined And over_limit for the Expression parameter.
  8. Add Table components to the Custom Filter (PilotScript) component pass and fail ports.

    The data records that are over the limit exit the pass port, and display in the first table. The data records below the limit exit the fail port, and display in the second table.



  9. Edit the Title parameter of the first table to Over the Limit, and Below the Limit for the second table.

Test the Advisor in Pipeline Creator

Make input and configuration form test data available, and then run the pipeline.

  1. Set up the test entity data:

    This is test data that is used as input to your pipeline.

    1. Open a dashboard with Formulation Design and Design Advisor.
    2. From Design Advisor, select the Capture My Data advisor.
    3. Click , and enter a path to a folder in your 3DDrive.
    4. Run the advisor.
    5. From Pipeline Creator, open the pipeline to the top level and click the work area.
    6. From the Parameters panel, change the EntityData parameter to point to the file in 3DDrive.
  2. Set up test initialization data:

    This is test data to populate your configuration form.

    1. Create a JSON string for each field in your configuration form using the following syntax:

      • Single field: { “field_name” : value }
      • Multiple fields: { “field_name 1” : value, “field_name 2” : value, “field_name 3” : value }
      • Array: { “field_name” : [“value 1”, “value 2”, “value 3”] }

      For the example form, use { “vc_amount_limit” : 500 }.

    2. From Pipeline Creator, navigate to the top level of the pipeline and click the work area.
    3. From the Parameters panel, select the InitializationData parameter, and enter the JSON strings you created.
  3. Run the pipeline.

    For more information, see Running the Pipeline.

  4. View the advisor report in the Data Cache panel.

Validate and Publish the Pipeline

To make your pipeline available to others in Design Advisor, it must be validated by a reviewer.

  1. Open your pipeline and select Save As, remove draft, and associate it with a Secure Collection that is available to other Design Advisor members.
  2. From the Pipeline Creator home page, click Manage Pipelines.
  3. From the Actions column, select Publish for the pipeline.
  4. Notify the person with Reviewer responsibility for the secure collection that the pipeline is ready for review.

    For information about validating a pipeline, see Validating a Pipeline for Publication.