get_nf_data {openappr}R Documentation

Get notification data from OpenAppBuilder

Description

This function retrieves data from the app_notification_interaction table in OpenAppBuilder and efficiently parses the notification_meta column from JSON format.

Usage

get_nf_data(
  site = get_app_connection(),
  filter = FALSE,
  filter_variable = NULL,
  filter_variable_value = NULL
)

Arguments

site

The name of the PostgreSQL database connection (using DBI::dbConnect or set_app_connection()).

filter

A logical value indicating whether to filter the data (defaults to FALSE).

filter_variable

A character string representing the name of the column to filter if filter == TRUE and filter_variable_value is provided.

filter_variable_value

A character string representing the value of the filter_variable column to filter if filter == TRUE.

Value

A data frame containing notification interaction data from OpenAppBuilder, with the notification_meta column parsed into separate columns.

Examples

# First we need to set an app connection
set_app_connection(
  dbname = "vmc",
  host = "apps-server.idems.international",
  port = 5432,
  user = "vmc",
  password = "LSQkyYg5KzL747"
)

# Retrieve all notification data
data_all_nf <- get_nf_data()

# Retrieve data where 'app_user_id' is '3e68fcda-d4cd-400e-8b12-6ddfabced348' 
# or '223925c7-443a-411c-aa2a-a394f991dd52'
valid_ids <- c("3e68fcda-d4cd-400e-8b12-6ddfabced348",
               "223925c7-443a-411c-aa2a-a394f991dd52")
data_filtered_users <- get_nf_data(
  filter = TRUE,
  filter_variable = "app_user_id",
  filter_variable_value = valid_ids
)

[Package openappr version 0.2.0 Index]