ON THIS PAGE:
P2 Server 4.5 is the engine that powers data retrieval from a variety of disparate sources, with built-in relationship models based on a Data Dictionary. P2 Server is how you get your data, transform it into more useful data, and then serve it up to other applications such as P2 Explorer or P2 Sentinel, for further analysis.
Patch Release 4.5.4 introduces the new ‘Adaptive Raw’ sample method, support for .gif images, and wildcard filtering. The ‘R Language’ infrastructure is now also available as a separate licensable component.
R Language Integration
This release of P2 Server introduces the R Language infrastructure, available as a separate licensable component. R is an open source programming language and software environment for statistical computing and graphics that is supported by the R Foundation for Statistical Computing.
Before you can use the R Script component, ensure that Microsoft R Open 3.3.3 or later (or the standard R installation) is installed on the same machine as P2 Server.
R Language Calculations
The R Language calculations allow you to access R, as a way of analysing data within your calculations.
RTimeSeries()
The new RTimeSeries() calculation function allows users to pass an R script into the calculation, and return values as time series data.
Format: RTimeSeries (Script [,Timestamp Pattern] [,Parameters])
Inputs:
Script | The R Input Symbols in a script that uses the R Language syntax. |
Timestamp Pattern | The formatting string used to pass the timestamps of the data points as text e.g. dd/M/yyyy H:mm:s |
Parameters | The parameters to use as inputs for the Script. |
Examples:
Expression: RTimeSeries('output$value <- parameter1', null, 5.6)
Output: Returns 5.6 as the value for each timestamp.
Expression: RTimeSeries('output$value <- parameter1Name', null, 2.2 + 3.4)
Output: Returns the string 2.2 + 3.4 as the value for each timestamp.
Expression: RTimeSeries('output$value <- smooth.spline(parameter1$timestamp, parameter1$value)$y', null, {silver})
Output: Fits a cubic smoothing spline on the values fetched by the Silver tag.
R Adaptor
The R adaptor is responsible for executing R scripts for the R Language functions. This adaptor supports 64-bit R engines and allows parallel R script execution by running multiple R adaptors at once with one R engine instance in each.
The R Adaptor differs from other adaptors in that it does not appear in P2 Server Management. Configuring the R Adaptor is done configured through the ServerConfig.xml. Here is an example configuration:
<ConfigGroup Name="R Adaptor"> <Param Key="RHome" Value="C:\Program Files\Microsoft\R Open\R-3.4.0" /> <Param Key="RRelativePath" Value="bin\x64" /> <Param Key="RAdaptorEnabled" Value="false" /> <Param Key="RAdaptorMinPoolSize" Value="2" /> <Param Key="RAdaptorMaxPoolSize" Value="8" /> <Param Key="RAdaptorInitTimeout" Value="60" /> <Param Key="RAdaptorRequestTimeout" Value="600" /> <CollectionParam Key="RAdaptorDisabledFunctions" Value="" /> <CollectionParam Key="RAdaptorEnabledPackages" Value="" /> </ConfigGroup>
The parameters are described as follows:
RHome | Main folder of the R installation. |
RRelativePath | Relative path of the R engine within the RHome folder. |
RAdaptorEnabled | True or False. Indicates whether the R Adaptor and thus executing R scripts is enabled. Default: false |
RAdaptorMinPoolSize | The smallest number of R Adaptor instances that will always be available to execute R scripts. Default: 2 |
RAdaptorMaxPoolSize | Largest number of R scripts that the system will attempt to execute simultaneously. Default: 8 |
RAdaptorInitTimeout | Time limit (in seconds) allowed for the R Adaptor to initially set up and configure the R engine before timing out. Default: 60 |
RAdaptorRequestTimeout | Time limit (in seconds) applied to all non-initialization operations against the R Adaptor. Default: 600 |
RAdaptorDisabledFunctions | Comma-separated list of additional R functions which are not allowed to be executed in R scripts. The following functions are considered insecure and are already permanently disabled in the R Adaptor: detach(), eval(), file.remove(), install.packages(), library(), require(), shell(), source(), system(), system2(), and unlink(). |
RAdaptorEnabledPackages | Comma-separated list of R packages which will be pre-loaded by the R Adaptor for executing R scripts. If a package is not in this list then it cannot be used inside a R expression. See Installing New Packages below. |
Installing New Packages
New packages cannot be installed using the standard installation functions, and must be installed by the system administrator. To install new packages:
- Download and install the R package onto the P2 Server machine.
- Add the name of the new package to the RAdaptorEnabledPackages This will ensure that the R adaptor will load and allow the new R package to be used.
- Restart the Data Broker Windows service to force the R adaptor to pick up the changes.
GIF Image Support
You can now add .gif images in P2 Server Management. This is in addition to existing support for .png, .jpg, .ico, and .svg images.
Wildcard Filtering
Wildcard filtering is now available in P2 Server Management and the P2 Server API.
- In the API, wildcards can be used by specifying a new filter querystring parameter in the URL (e.g. ?filter=*ilv*)
- In Server Management, filters for tags and entities now accept wildcard characters.
The following wildcards are available:
* Match any number of characters either before or after the asterisk
? Match a single character
You can use wildcard filters to filter on names and descriptions for tags and entities. Here are some examples:
Example | P2 Server Management Result (tag/entity search) | API Result (new filter parameter) |
ilv | Return anything containing ilv (this was also the previous behaviour) | Return an exact match for ilv |
*ilv* | Return anything containing ilv | Return anything containing ilv |
*ing | Return anything ending with ing | Return anything ending with ing |
silv* | Return anything starting with silv | Return anything starting with silv |
s*r | Return anything starting with s and ending with r | Return anything starting with s and ending with r |
silv?r | Return anything starting with silv and ending with r, with a single character in between | Return anything starting with silv and ending with r, with a single character in between |
s????r | Return anything starting with s and ending with r, with 4 characters between | Return anything starting with s and ending with r, with 4 characters between |
Note: In P2 Server Management, the previous behaviour was to treat * and ? as literal characters that should be matched.
New ‘Adaptive Raw’ Sample Method
The new Adaptive Raw sample method allows raw data to be displayed by consuming applications, such as the Explorer trend, at a much faster rate than was previously possible using raw data.
Previous Releases
For a complete list of P2 Server release notes, see Server Releases.