Creating Custom Functions

Custom functions are created using the same framework as our Report and Infographic addons.

Each custom function is placed in its own folder, along with configuration files and any other files that are required for the function to execute.

By default, each custom function should be in the functions folder inside your ARDI site directory. For example, if you've installed ARDI to C:\ARDI and you are using your default site, the folder would be…

C:\ARDI\web\sites\default\functions

Folder Content

Each folder contains at least an info.json file that describes the key details about the API function.

It may also contain other files, such as those below…

File NamePurpose
desc.htmlHTML content to describe the function, provide examples etc.
script filesPython, batch or formatting scripts

Info File Contents

The info.json file defines key details about the API function. This includes…

PropertyMeaning
nameThe friendly name for the API function
descA plain text description of the function
methodThe method used to return API data
folderThe organisational folder to place the API function into
parametersThe parameters to the function
stylesThe available output formats
{
	"name": "Output Temperature",
	"method": "python",	
	"desc": "Returns the expected output temperature given the input temperature",
	"parameters": [ {
             "name": "Input Temp",
             "type": "float", 
             "tag": "temp",
             "max": "500", 
             "min": "0", 
             "default": 65,
             "source": "Product.Temperature - Entry"}],	
	"folder": "DFT Model"
}

This example describes a function called 'Output Temperature' - using the Python method - that includes a single parameter.

Parameter options are described later - they are used to not only describe the parameters, but to power the user interface to help test/demonstrate them.