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 Name | Purpose |
---|---|
desc.html | HTML content to describe the function, provide examples etc. |
script files | Python, batch or formatting scripts |
Info File Contents
The info.json file defines key details about the API function. This includes…
Property | Meaning |
---|---|
name | The friendly name for the API function |
desc | A plain text description of the function |
method | The method used to return API data |
folder | The organisational folder to place the API function into |
parameters | The parameters to the function |
styles | The 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.