BusinessLogic: Business logic of the app

BusinessLogicR Documentation

Business logic of the app

Description

Responsible for the data wrangling, generation of text and charts and (it might be a bit of overkill in this app) filtering for the user interface. See [Using R6 as data storage](https://engineering-shiny.org/common-app-caveats.html#using-r6-as-data-storage) for more information on this solution.

Public fields

months

Month numbers and their names, on the app selecting the month's name will return the month's number.

metrics

Available metrics with better looking names for the app.

data

Will store the data (more useful for bigger apps).

unique_carriers

Available carriers (more useful in the case of a database with more carriers being added over time).

results

Where results (title and text for the page and the chart itself) are stored.

Methods

Public methods


Method new()

Create a new business logic object.

Usage
BusinessLogic$new()
Returns

A new 'BusinessLogic' object.

Examples
business_logic <- BusinessLogic$new()

business_logic$generate_results("Endeavor Air", 1, "arr_delay", 30)

business_logic$results$title

business_logic$results$text

business_logic$results$chart

Method generate_results()

Generate results, all parameters come directly from the user interface of the app.

Usage
BusinessLogic$generate_results(
  carrier_filter,
  month_filter,
  metric_filter,
  threshold
)
Arguments
carrier_filter

Carrier for report.

month_filter

Month for report.

metric_filter

Metric for report.

threshold

Threshold for report.


Method clone()

The objects of this class are cloneable with this method.

Usage
BusinessLogic$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `BusinessLogic$new`
## ------------------------------------------------

business_logic <- BusinessLogic$new()

business_logic$generate_results("Endeavor Air", 1, "arr_delay", 30)

business_logic$results$title

business_logic$results$text

business_logic$results$chart

ggpinto/flights.dashboard documentation built on March 24, 2022, 12:38 p.m.