Market Performance Standards

Performance Charges

mps_data_clean %>%
  dplyr::filter(
    Period <= data.period
    ) %>%
  dplyr::select(
    Period, Charges, Group
    ) %>%
  dplyr::group_by(Period, Group) %>%
  dplyr::summarise(
    Charges = sum(Charges)
    ) %>%
  ggplot2::ggplot(
    ggplot2::aes(x = Period, y = Charges, fill = Group)
    ) + 
  ggplot2::geom_bar(stat = "identity") + 
  ggplot2::theme(
    legend.title = ggplot2::element_blank(),
    text = ggplot2::element_text(size = 15)
    ) +
  ggplot2::scale_y_continuous(
    labels = scales::dollar_format(prefix = "£"),
    breaks = scales::pretty_breaks(4)
    ) +
  ggplot2::theme_bw() +
  ggplot2::scale_fill_manual(values = c("#425563", "#05C3DE", "#005F83", "#00A499", "#FFAA4D", "#F9E547", "#8866BC")) +
  ggplot2::labs(
    title = "Performance Charges",
    subtitle = "Breakdown by month and standard grouping",
    caption = "Source: MOSL"
    ) +
  ggplot2::ylab("") + ggplot2::xlab("")
# Creating table of charges by MPS ---------------- 

mps_data_clean %>%
  dplyr::filter(
      Period >= data.period %m-% months(11),
      Charges > 0
    ) %>%
  base::droplevels() %>%
  dplyr::select(Period, Standard, Charges) %>%
  dplyr::mutate(
    Period = format(Period, "%Y-%m"),
    Charges = tidyr::replace_na(Charges, 0)
    ) %>% 
  tidyr::drop_na(Charges) %>%
  base::droplevels() %>%
  dplyr::group_by(Period, Standard) %>%
  dplyr::summarise(
    Charges = sum(Charges, na.rm = TRUE)
    ) %>%
  dplyr::ungroup() %>%
  tidyr::spread(Standard, Charges) %>%
  dplyr::mutate(
    Total = rowSums(dplyr::select(., -Period), na.rm = TRUE)
  ) %>%
  dplyr::mutate_if(~ any(is.na(.)), ~ ifelse(is.na(.), 0, .)) %>%
  dplyr::mutate_if(is.numeric, scales::dollar_format(prefix = "£")) %>%
  tidyr::gather("Standard", "Charges", -Period) %>%
  tidyr::spread(Period, Charges) %>%
  kableExtra::kable(
    format = "latex", 
    caption = "Breakdown of Charges by Standard", 
    linesep = "",
    format.args = list(big.mark = ","),
    booktabs = TRUE,
    align = "c"
    ) %>%
  kableExtra::kable_styling(
    font_size = 10,
    latex_options = c(
      "repeat_header",
      "hold_position",
      "striped",
      position = "center", 
      full_width = FALSE,
      "scale_down"
      )
    ) %>%
  kableExtra::row_spec(0, bold = TRUE)

Performance Overview

As of r format(data.period, "%B-%Y"), MOSL were monitoring Trading Party performance against r length(unique(perf_status_mps$Standard)) standards. Performance for these standards is measured according to:

agg_perf <- mps_data_clean %>%
  dplyr::group_by(Period) %>%
  dplyr::summarise(
    Perf = sum(OnTimeTasks, na.rm = TRUE) / sum(TaskVolume, na.rm = TRUE)
    ) %>%
  dplyr::ungroup() %>%
  dplyr::mutate(
    Agg_Perf = zoo::rollapply(Perf, 6, mean, align = "right", fill = NA)
    ) %>%
  dplyr::rename(GroupPerf = Agg_Perf) %>%
  dplyr::mutate(Group = "Aggregate Performance")

mps_data_clean %>%
  dplyr::group_by(Period, Group) %>%
  dplyr::summarise(
    Perf = sum(OnTimeTasks) / sum(TaskVolume),
    ) %>%
  dplyr::ungroup() %>%
  dplyr::group_by(Group) %>%
  dplyr::mutate(
    GroupPerf = zoo::rollapply(Perf, 6, mean, align = "right", fill = NA)
    ) %>%
  dplyr::ungroup() %>%
  base::rbind(., agg_perf) %>%
  droplevels() %>%
  tidyr::drop_na() %>%
  ggplot2::ggplot() + 
  ggplot2::geom_line(
    ggplot2::aes(
      x = Period, 
      y = GroupPerf, 
      colour = Group,
      linetype = Group
      )
    ) +
  ggplot2::geom_point(
    ggplot2::aes(
      x = Period, 
      y = GroupPerf,
      colour = Group,
      fill = Group,
      shape = Group
      )
    ) +
  ggplot2::theme(
    legend.title = ggplot2::element_blank(),
    text = ggplot2::element_text(size = 15)
    ) +
  ggplot2::scale_y_continuous(
    labels = scales::percent_format(accuracy = 1),
    breaks = scales::pretty_breaks(4)
    ) +
  ggplot2::theme_bw() + 
  ggplot2::scale_colour_manual(
    values = c("#425563", "#05C3DE", "#005F83", "#00A499", "#FFAA4D", "#F9E547", "#8866BC")
    ) +
  ggplot2::scale_fill_manual(
    values = c("#425563", "#05C3DE", "#005F83", "#00A499", "#FFAA4D", "#F9E547", "#8866BC")
    ) +
  ggplot2::labs(
    title = paste0("MPS On-Time Task Completion"),
    subtitle = "Breakdown by month and standard",
    caption = "Source: MOSL\nNote: Aggregate performance corresponds to the 6-month average of aggregate MPS performance"
    ) +
  ggplot2::ylab("") + ggplot2::xlab("")
mps_data_clean %>% 
  dplyr::filter(
    Period >= max(mps_data_clean$Period) %m-% months(11)
    ) %>%
  dplyr::group_by(Period, Standard) %>%
  dplyr::summarise(
    Performance = sum(OnTimeTasks, na.rm = TRUE) / sum(TaskVolume, na.rm = TRUE)
    ) %>%
  dplyr::ungroup() %>%
  dplyr::mutate(
    Performance = scales::percent(Performance, accuracy = 1),
    Period = format(Period, "%Y-%m")
    ) %>%
  tidyr::spread(Period, Performance) %>%
  kableExtra::kable(
    format = "latex", 
    caption = "MPS Performance by Month",
    linesep = "",
    format.args = list(big.mark = ","),
    booktabs = TRUE,
    align = "c"
    ) %>%
  kableExtra::kable_styling(
    font_size = 10,
    latex_options = c(
      "repeat_header",
      "hold_position",
      "striped",
      position = "center", 
      full_width = FALSE,
      "scale_down"
      )
    ) %>%
  kableExtra::row_spec(0, bold = TRUE)
for(sub.type in unique(mps_aggregate_perf$sub_type[!is.na(mps_aggregate_perf$sub_type)])){
  tryCatch(
    expr = {
      plot(mps_aggregate_perf %>%
    dplyr::filter(
      sub_type == sub.type,
      Period == data.period
      ) %>%
    ggplot2::ggplot() +
    ggplot2::geom_bar(
      ggplot2::aes(
        x = reorder(ShortName, Agg_Perf_roll), 
        y = Agg_Perf_roll
        ), 
      stat = "identity",
      show.legend = FALSE,
        fill = "azure3",
        col = "black") +
    ggplot2::scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
    ggplot2::coord_flip() +
    ggplot2::theme_bw() +
    ggplot2::theme(
      text = ggplot2::element_text(size = 15)
      ) +
    ggplot2::labs(
      title = "Ranking of Overall MPS Performance",
      subtitle = 
        paste0(
          "Rolling 6-month mean of aggregate MPS performance by Trading Party (", sub.type, ")"
          ),
      caption = "Source: MOSL"
      ) +
    ggplot2::ylab("") + ggplot2::xlab(""))
    }, error = function(e){}
  )

}

Performance Monitoring and Rectification

Status Summary

There are currently r nrow(perf_status_mps%>%dplyr::filter(Period == data.period, ActiveIPRP == T)) Active IPRPs and r nrow(perf_status_mps%>%dplyr::filter(Period == data.period, ActivePRP == T)) Active PRPs for r nrow(perf_status_mps%>%dplyr::filter(Period == data.period,ActiveIPRP == T | ActivePRP == T)%>% dplyr::count(Trading.Party.ID)) Trading Parties and r nrow(perf_status_mps%>%dplyr::filter(Period == data.period,ActiveIPRP == T | ActivePRP == T)%>% dplyr::count(Standard)) different MPS standards.

Rectification_sum <- perf_status_mps%>%
  dplyr::filter(
    Period == data.period,
    ActiveIPRP == T | ActivePRP == T)%>%
  dplyr::count(Standard, Status)%>%
  tidyr::pivot_wider(names_from = Status, values_from = n,values_fill = list(n = 0))%>%
  dplyr::mutate(
    Total = rowSums(
      dplyr::select(., -Standard), 
      na.rm = T)
    )%>%
  dplyr::select(
    Standard, 
    sort(names(.))
    )

tryCatch(
  expr = {
      kableExtra::kable(
        Rectification_sum,
        format = "latex", 
        caption = "Number of Active Rectification plans by Standard",
        booktabs=TRUE,
        linesep=""
      ) %>%
    kableExtra::kable_styling(
      latex_options = c(
        "repeat_header",
        "hold_position",
        "striped",
        position = "center", 
        full_width = FALSE,
        "scale_down")
      ) %>%
    kableExtra::row_spec(0, bold = TRUE)%>%
  kableExtra::column_spec(ncol(Rectification_sum)-1, border_right = T)
  }, error = function(e){}
)

Retification count & matrix

tryCatch(
  expr = {
    perf_status_mps%>%
  dplyr::filter(
    Period == data.period,
    ActiveIPRP == T | ActivePRP == T)%>%
  tidyr::pivot_wider(id_cols = Trading.Party.ID, names_from = Standard, values_from = Status, values_fill = list(Status = ""))%>%
  dplyr::rename("Trading Party" = Trading.Party.ID)%>%
  dplyr::select("Trading Party", sort(names(.)))%>%
  kableExtra::kable(
    format = "latex", 
    caption = "Number of Active Rectification plans by Trading Party",
    linesep = "",
    format.args = list(big.mark = ","),
    booktabs = TRUE,
    align = "c"
    ) %>%
  kableExtra::kable_styling(
    font_size = 10,
    latex_options = c(
      "repeat_header",
      "HOLD_position",
      "striped",
      position = "center", 
      full_width = FALSE,
      "scale_down"
      )
    ) %>%
  kableExtra::row_spec(0, bold = TRUE)
  }, error = function(e){}
)

Watch-list and areas of concern

There are currently r nrow(perf_status_mps%>%dplyr::filter(Period == data.period, Action == "Watch")) Trading Parties on watch for MPS performance.

tryCatch(
  expr = {
    perf_status_mps%>%
  dplyr::filter(Period == data.period,
         Action == "Watch")%>%
  dplyr::select(Trading.Party.ID, Standard)%>%
  kableExtra::kable(
    format = "latex", 
    caption = "Trading Parties on watch for MPS performance",
    col.names = c(
      "Trading Party", "MPS"),
    longtable = TRUE, 
    booktabs=TRUE,
    linesep=""
      ) %>%
    kableExtra::kable_styling(
      latex_options = c(
        "repeat_header",
        "hold_position",
        "striped",
        position = "center", 
        full_width = FALSE)
      ) %>%
    kableExtra::row_spec(0, bold = TRUE)
  }, error = function(e){}
)

Detailed Rectification Analysis

Below are the Performance graphs of Rectification plans that are either Off-track or under review

IPRP_details_list <- perf_status_mps%>%
  dplyr::filter(
    Period == data.period, 
    (Status == "IPRP: Below plan" | Status == "PRP: Below plan" | UnderReview == T)
  )

if(nrow(IPRP_details_list)>0){
  for(i in 1:nrow(IPRP_details_list)){
  plot(MOSLR::plot_perf_graph(
  df = perf_status_mps,
  trading.party = IPRP_details_list$Trading.Party.ID[i],
  standard = IPRP_details_list$Standard[i], 
  include.iprp = T,
  graph.title = paste(IPRP_details_list$Trading.Party.ID[i], IPRP_details_list$Standard[i])
))
}
}

Market Aggregates

metrics.list <- c("MarketMean", "MarketMedian", "MarketTaskVolume")

for (METRIC in metrics.list) {

  mps_summary %>% 
    dplyr::select(
      Period, Standard, METRIC
      ) %>% 
    dplyr::filter(
      Period >= data.period %m-% months(11)
      ) %>% 
    dplyr::mutate(Period = format(Period, "%Y-%m")) %>%
    tidyr::spread(Period, METRIC) %>%
    dplyr::mutate_if(
      is.numeric, 
      ifelse(
        METRIC != "MarketTaskVolume", 
        scales::percent_format(accuracy = 1), 
        scales::number_format(big.mark = ",", accuracy = 1)
        )
      ) %>%
    kableExtra::kable(
      format = "latex", 
      caption = paste0("Market", base::gsub("Market", x = METRIC, replacement = " ")), 
      linesep = "",
      digits = 1,
      booktabs = TRUE,
      align = "c"
      ) %>%
    kableExtra::kable_styling(
      latex_options = c(
        "repeat_header",
        "HOLD_position",
        "striped",
        "scale_down"
        )
      ) %>%
    kableExtra::row_spec(0, bold = TRUE) %>%
    print()

  cat("\n")

}

\newpage

Operational Performance Standards

Performance Charges

ops_data_clean %>%
    dplyr::filter(
      Charges > 0
      ) %>%
    tidyr::drop_na(Charges) %>%
    base::droplevels() %>%
    ggplot2::ggplot(
      ggplot2::aes(x = Period, y = Charges, fill = Group)
      ) + 
    ggplot2::geom_bar(stat = "identity") + 
    ggplot2::theme(
      text = ggplot2::element_text(size = 15)
      ) +
    ggplot2::scale_y_continuous(
      labels = scales::dollar_format(prefix = "£"),
      breaks = scales::pretty_breaks(4)
      ) +
    ggplot2::theme_bw() + 
    ggplot2::scale_fill_manual(values = c("#425563", "#05C3DE", "#005F83", "#00A499", "#FFAA4D", "#F9E547", "#8866BC")) +
    ggplot2::labs(
      title = "Performance Charges by OPS Group",
      subtitle = "Breakdown by month and standard grouping",
      caption = "Source: MOSL",
      fill = "OPS Group"
      ) +
    ggplot2::ylab("") + ggplot2::xlab("")
# Creating table of charges by OPS ---------------- 

ops_data_clean %>%
  dplyr::filter(
      Period >= data.period %m-% months(11),
      Charges > 0
    ) %>%
  base::droplevels() %>%
  dplyr::select(Period, Standard, Charges) %>%
  dplyr::mutate(
    Period = format(Period, "%Y-%m"),
    Charges = tidyr::replace_na(Charges, 0)
    ) %>% 
  tidyr::drop_na(Charges) %>%
  base::droplevels() %>%
  dplyr::group_by(Period, Standard) %>%
  dplyr::summarise(
    Charges = sum(Charges, na.rm = TRUE)
    ) %>%
  dplyr::ungroup() %>%
  tidyr::spread(Standard, Charges) %>%
  dplyr::mutate(
    Total = rowSums(dplyr::select(., -Period), na.rm = TRUE)
  ) %>%
  dplyr::mutate_if(~ any(is.na(.)), ~ ifelse(is.na(.), 0, .)) %>%
  dplyr::mutate_if(is.numeric, scales::dollar_format(prefix = "£")) %>%
  tidyr::gather("Standard", "Charges", -Period) %>%
  tidyr::spread(Period, Charges) %>%
  kableExtra::kable(
    format = "latex", 
    caption = "Breakdown of Charges by Standard", 
    linesep = "",
    format.args = list(big.mark = ","),
    booktabs = TRUE,
    align = "c"
    ) %>%
  kableExtra::kable_styling(
    font_size = 10,
    latex_options = c(
      "repeat_header",
      "hold_position",
      "striped",
      position = "center", 
      full_width = FALSE,
      "scale_down"
      )
    ) %>%
  kableExtra::row_spec(0, bold = TRUE)

Performance Overview

As of r format(data.period, "%B-%Y"), MOSL were monitoring Trading Party performance against r length(unique(perf_status_ops$Standard[!is.na(perf_status_ops$Standard)])) standards. Performance for these standards is measured according to:

agg_perf <- ops_data_clean %>%
  dplyr::group_by(Period, PerformanceMeasure) %>%
  dplyr::summarise(
    Perf = sum(OnTimeTasks, na.rm = TRUE) / sum(TaskVolume, na.rm = TRUE)
    ) %>%
  dplyr::ungroup() %>%
  dplyr::mutate(
    Agg_Perf = zoo::rollapply(Perf, 6, mean, align = "right", fill = NA)
    ) %>%
  dplyr::rename(GroupPerf = Agg_Perf) %>%
  dplyr::mutate(Group = "Aggregate Performance")

ops_data_clean %>%
  dplyr::group_by(Period,PerformanceMeasure, Group) %>%
  dplyr::summarise(
    Perf = sum(OnTimeTasks) / sum(TaskVolume),
    ) %>%
  dplyr::ungroup() %>%
  dplyr::group_by(Group) %>%
  dplyr::mutate(
    GroupPerf = zoo::rollapply(Perf, 6, mean, align = "right", fill = NA)
    ) %>%
  dplyr::ungroup() %>%
  base::rbind(., agg_perf) %>%
  droplevels() %>%
  tidyr::drop_na() %>%
  ggplot2::ggplot() + 
  ggplot2::geom_line(
    ggplot2::aes(
      x = Period, 
      y = GroupPerf, 
      colour = Group,
      linetype = Group
      )
    ) +
  ggplot2::geom_point(
    ggplot2::aes(
      x = Period, 
      y = GroupPerf,
      colour = Group,
      fill = Group,
      shape = Group
      )
    ) +
  ggplot2::theme(
    legend.title = ggplot2::element_blank(),
    text = ggplot2::element_text(size = 15)
    ) +
  ggplot2::scale_y_continuous(
    labels = scales::percent_format(accuracy = 1),
    breaks = scales::pretty_breaks(4)
    ) +
    ggplot2::theme_bw() + 
    ggplot2::scale_colour_manual(
      values = c("#425563", "#05C3DE", "#005F83", "#00A499", "#FFAA4D", "#F9E547", "#8866BC")
      ) +
    ggplot2::scale_fill_manual(
      values = c("#425563", "#05C3DE", "#005F83", "#00A499", "#FFAA4D", "#F9E547", "#8866BC")
      ) +
    ggplot2::labs(
      title = paste0("Completed and Outstanding Tasks OPS Performance"),
      subtitle = "Breakdown by month and OPS standard grouping",
      caption = "Note: Aggregate performance corresponds to the 6-month average of aggregate OPS performance\nSource: MOSL"
      ) +
    ggplot2::ylab("") + ggplot2::xlab("") +
    ggplot2::facet_wrap(~PerformanceMeasure)
ops_data_clean %>% 
  dplyr::filter(
    Period >= max(ops_data_clean$Period, na.rm = T) %m-% months(11),
    PerformanceMeasure == "Completed"
    ) %>%
  dplyr::group_by(Period, Standard) %>%
  dplyr::summarise(
    Performance = sum(OnTimeTasks, na.rm = TRUE) / sum(TaskVolume, na.rm = TRUE)
    ) %>%
  dplyr::ungroup() %>%
  dplyr::mutate(
    Performance = scales::percent(Performance, accuracy = 1),
    Period = format(Period, "%Y-%m")
    ) %>%
  tidyr::spread(Period, Performance) %>%
  kableExtra::kable(
    format = "latex", 
    caption = "OPS Performance by Month",
    linesep = "",
    format.args = list(big.mark = ","),
    booktabs = TRUE,
    align = "c"
    ) %>%
  kableExtra::kable_styling(
    font_size = 10,
    latex_options = c(
      "repeat_header",
      "hold_position",
      "striped",
      position = "center", 
      full_width = FALSE,
      "scale_down"
      )
    ) %>%
  kableExtra::row_spec(0, bold = TRUE)
for(sub.type in unique(ops_aggregate_perf$sub_type[!is.na(ops_aggregate_perf$sub_type)])){
  tryCatch(
    expr = {
      plot(ops_aggregate_perf %>%
    dplyr::filter(
      sub_type == sub.type,
      Period == data.period,
      PerformanceMeasure == "Completed"
      ) %>%
    ggplot2::ggplot() +
    ggplot2::geom_bar(
      ggplot2::aes(
        x = reorder(ShortName, Agg_Perf_roll), 
        y = Agg_Perf_roll
        ), 
      stat = "identity",
      show.legend = FALSE,
        fill = "azure3",
        col = "black") +
    ggplot2::scale_y_continuous(labels = scales::percent_format(accuracy = 1)) +
    ggplot2::coord_flip() +
    ggplot2::theme_bw() +
    ggplot2::theme(
      text = ggplot2::element_text(size = 15)
      ) +
    ggplot2::labs(
      title = "Ranking of Overall OPS Performance",
      subtitle = 
        paste0(
          "Rolling 6-month mean of aggregate OPS performance by Trading Party (", sub.type, ")"
          ),
      caption = "Source: MOSL"
      ) +
    ggplot2::ylab("") + ggplot2::xlab(""))
    }, error = function(e){}
  )

}

Performance Monitoring and Rectification

Status Summary

There are currently r nrow(perf_status_ops%>%dplyr::filter(Period == data.period, ActiveIPRP == T)) Active IPRPs and r nrow(perf_status_ops%>%dplyr::filter(Period == data.period, ActivePRP == T)) Active PRPs for r nrow(perf_status_ops%>%dplyr::filter(Period == data.period,ActiveIPRP == T | ActivePRP == T)%>% dplyr::count(Trading.Party.ID)) Trading Parties and r nrow(perf_status_ops%>%dplyr::filter(Period == data.period,ActiveIPRP == T | ActivePRP == T)%>% dplyr::count(Standard, PerformanceMeasure)) different OPS standards.

perf_status_ops%>%
  dplyr::filter(
    Period == data.period,
    ActiveIPRP == T | ActivePRP == T)%>%
  dplyr::mutate(Standard = paste(Standard, PerformanceMeasure))%>%
  dplyr::count(Standard, Status)%>%
  tidyr::pivot_wider(names_from = Status, values_from = n,values_fill = list(n = 0))%>%
  dplyr::mutate(
    Total = rowSums(
      dplyr::select(., -Standard), 
      na.rm = T)
    )%>%
  kableExtra::kable(
    format = "latex", 
    caption = "Number of Active Rectifications by Standard",
    longtable = TRUE, 
    booktabs=TRUE,
    linesep=""
      ) %>%
    kableExtra::kable_styling(
      latex_options = c(
        "repeat_header",
        "hold_position",
        "striped",
        position = "center", 
        full_width = FALSE)
      ) %>%
    kableExtra::row_spec(0, bold = TRUE)%>%
  kableExtra::column_spec(4, border_right = T)

Rectification count & matrix

perf_status_ops%>%
  dplyr::filter(
    Period == data.period,
    ActiveIPRP == T | ActivePRP == T)%>%
  dplyr::mutate(Standard = paste(Standard, PerformanceMeasure))%>%
  tidyr::pivot_wider(id_cols = Trading.Party.ID, names_from = Standard, values_from = Status, values_fill = list(Status = ""))%>%
  dplyr::rename("Trading Party" = Trading.Party.ID)%>%
  dplyr::select("Trading Party", sort(names(.)))%>%
  kableExtra::kable(
    format = "latex", 
    caption = "Number of Active Rectification plans by Trading Party",
    linesep = "",
    format.args = list(big.mark = ","),
    booktabs = TRUE,
    align = "c"
    ) %>%
  kableExtra::kable_styling(
    font_size = 10,
    latex_options = c(
      "repeat_header",
      "HOLD_position",
      "striped",
      position = "center", 
      full_width = FALSE
      )
    ) %>%
  kableExtra::row_spec(0, bold = TRUE)%>%
  kableExtra::column_spec(2:(nrow(perf_status_ops%>%dplyr::filter(Period == data.period,ActiveIPRP == T | ActivePRP == T)%>% dplyr::count(Standard, PerformanceMeasure))+1),width = "2.5cm")

Watch-list and areas of concern

There are currently r nrow(perf_status_ops%>%dplyr::filter(Period == data.period, Action == "Watch")) Trading Parties on watch for OPS performance.

perf_status_ops%>%
  dplyr::filter(Period == data.period,
         Action == "Watch")%>%
  dplyr::mutate(Standard = paste(Standard, PerformanceMeasure))%>%
  dplyr::select(Trading.Party.ID, Standard)%>%
  kableExtra::kable(
    format = "latex", 
    caption = "Trading Parties on watch for OPS performance",
    col.names = c(
      "Trading Party", "OPS"),
    longtable = TRUE, 
    booktabs=TRUE,
    linesep=""
      ) %>%
    kableExtra::kable_styling(
      latex_options = c(
        "repeat_header",
        "hold_position",
        "striped",
        position = "center", 
        full_width = FALSE)
      ) %>%
    kableExtra::row_spec(0, bold = TRUE)

Detailed Rectification Analysis

Below are the Performance graphs of IPRPs that are either Off-track or under review

IPRP_details_list <- perf_status_ops%>%
  dplyr::filter(
    Period == data.period, 
    (Status == "IPRP: Below plan" | Status == "PRP: Below plan" | UnderReview == T)
  )

if(nrow(IPRP_details_list)>0){
  for(i in 1:nrow(IPRP_details_list)){
  plot(MOSLR::plot_perf_graph(
  df = perf_status_ops,
  trading.party = IPRP_details_list$Trading.Party.ID[i],
  standard = IPRP_details_list$Standard[i], 
  include.iprp = T,
  graph.title = paste(IPRP_details_list$Trading.Party.ID[i], IPRP_details_list$Standard[i], IPRP_details_list$PerformanceMeasure[i]),
  performance.measure = IPRP_details_list$PerformanceMeasure[i]
))
}
}


Market Aggregates

metrics.list <- c("MarketMean", "MarketMedian", "MarketTaskVolume")

for (METRIC in metrics.list) {

  for (MEASURE in unique(ops_summary$PerformanceMeasure)) {

    ops_summary %>% 
      dplyr::filter(
        PerformanceMeasure == MEASURE
        ) %>%
      tidyr::drop_na() %>%
      dplyr::select(
        Period, Standard, METRIC
        ) %>% 
      dplyr::filter(
        Period >= data.period %m-% months(11)
        ) %>% 
      dplyr::mutate(Period = format(Period, "%Y-%m")) %>%
      tidyr::spread(Period, METRIC) %>%
      dplyr::mutate_if(
        is.numeric, 
        ifelse(
          METRIC != "MarketTaskVolume", 
          scales::percent_format(accuracy = 1), 
          scales::number_format(big.mark = ",", accuracy = 1)
          )
        ) %>%
      kableExtra::kable(
        format = "latex", 
        caption = paste0("Market", base::gsub("Market", x = METRIC, replacement = " "), " (", MEASURE, ")"), 
        linesep = "",
        digits = 1,
        booktabs = TRUE,
        align = "c"
        ) %>%
      kableExtra::kable_styling(
        latex_options = c(
          "repeat_header",
          "HOLD_position",
          "striped",
          "scale_down"
          )
        ) %>%
      kableExtra::row_spec(0, bold = TRUE) %>%
      print()

    cat("\n")

  }

}

\newpage

MPOP Reporting

res <- knitr::knit_child(
    "MPOP.Rmd", envir = environment(), quiet = TRUE
    )

cat(res, sep = '\n')


austl001/MOSLR documentation built on Aug. 17, 2022, 12:07 a.m.