Altair Knowledge Works

 

Editing Node Codes

Any configuration made to a node plugin, once saved, is converted into the appropriate code, which can be viewed by clicking the Code tab in the Node Viewer.

 

Activating the Code Editor allows you to make changes to your code. You could use this functionality, for instance, to create a custom aggregate function (e.g., 90th percentile of hours worked per week by a certain population) from one of the predefined functions (e.g., median of hours worked per week) available in Knowledge Works.

Editing the Node Code with a Saved Configuration

Steps

  1. Save all of your work in the Configuration tab and then click the Code tab. Your current configuration displays in the Code Editor.

  2.  

  3. Click the Edit Code button in the Editor section of the Code tab. The following message displays.

  4.  

  5. Click Yes, edit code.

  6. The Code Editor is activated, and you can begin modifying the code as necessary. Note that knowledge of Python or PySpark, depending on the engine used (Jupyter Pandas and Jupyter Spark, respectively), is necessary to produce code with the desired output.

     

    Let's say you want to calculate the 90th percentile of hours worked per week for certain levels of education in some population of individuals. The 90th Percentile function is not currently available in Knowledge Works. To produce your desired calculation, you could modify the code generated by the Median function, which is available in the application, as shown below:

     

    to this:

     

  7. Click Save to apply your code changes to the node and Run to execute the code.

  8. Following the example given in Step 3, the resulting table changes from this:

     

    to this:

     

    NOTE: Editing the code of the Import, Export, and AutoML nodes results in an error when the updated code is run. This is a known issue that will be addressed in the next release of the application.

Editing the Node Code Without a Saved Configuration

Steps

  1. In the Node Viewer, make the necessary changes to your node in the Configuration tab.

  2. Without saving your configuration, click on the Code tab and then select Edit Code. The following message displays instead.

  3.  

  4. Click Edit without saving to activate the Code Editor without saving the node configuration or Save and edit to activate the Code Editor after saving the node configuration.

  5. The Code Editor is activated, and you can begin modifying the code as necessary.

     

  6. Click Save to apply your code changes to the node and Run to execute the code.

  7. NOTE: Editing the code of the Import, Export, and AutoML nodes results in an error when the updated code is run. This is a known issue that will be addressed in the next release of the application.

Activating a Saved Configuration After Editing a Code

When the Code Editor is activated, the saved configuration of a node is deactivated. The saved configuration of a node can be activated by clicking on the Configuration tab and then selecting Enable Configuration.

 

Click Yes, enable to proceed with activating the saved configuration.

When the saved configuration is enabled, all saved changes implemented in the Code Editor prior to enabling the saved configuration are discarded. If the node configuration is updated and saved, these changes are reflected in the Code Editor.