trendminer is an R client for accessing selected endpoints of the TrendMiner API that is documented at http://developer.trendminer.com. TrendMiner is an industrial self-service analytics platform for analyzing, monitoring and predicting time-series based process and asset data.

Installation

Usage

Below are some things you can do after installing the package. Check out the introduction vignette and the docs for further details.

Start with fetching an access token which you’ll need for any subsequent API call:

Browse and explore the site/plant structures starting on top with the available root structures:

Search for specific assets/tags or retrieve all tags at once

Fetch time series data of a tag:

Visualize fetched time series data:

library(ggplot2)

tag_data$timeSeries %>%
  ggplot(aes(index, value)) +
  geom_line(color = "#09557f") +
  ggtitle(tag_data$tag$tagName) +
  theme_minimal()

Authentication

All requests to the TrendMiner API require authentication using a valid Bearer access token that is sent as part of the request headers.

Request tokens are obtained via OAuth2.0 using a resource owner password credentials flow. Any client which likes to interact with the API needs to collect the credentials from the user (username and password) and passes them together with its own client credentials (client ID and client secret) to the TrendMiner server using the tm_token() function. The server responds with an access token which the user needs to use for any subsequent API requests.

User credentials, client credentials and the TrendMiner base URL can be passed as arguments to tm_token() for quick testing in interactive mode. However, it is recommended to call tm_token() without arguments. In this case tm_token() will fetch the credentials and the TrendMiner base URL from the environment variables below which you need to store in .Renviron. You can easily edit .Renviron using usethis::edit_r_environ().