Spaces:
Running
Running
phantomas34 commited on
Commit ·
d6e058e
1
Parent(s): 1432ced
remove: Estimator Scatter tab — redundant with K-Means; claustrophobic layout
Browse files
server.R
CHANGED
|
@@ -852,169 +852,6 @@ function(input, output, session) {
|
|
| 852 |
ggplotly(p, tooltip = "text")
|
| 853 |
})
|
| 854 |
|
| 855 |
-
# ── ESTIMATOR SCATTER ─────────────────────────────────────────────────────
|
| 856 |
-
|
| 857 |
-
# Aggregate filtered_data() per estimator — no separate DB query needed.
|
| 858 |
-
# Inherits the sidebar date range and estimator picker automatically.
|
| 859 |
-
scatter_agg <- reactive({
|
| 860 |
-
d <- filtered_data()
|
| 861 |
-
lwr <- lag_win_rate()
|
| 862 |
-
validate(need(nrow(d) > 0, "No data in selected range."))
|
| 863 |
-
|
| 864 |
-
agg <- d %>%
|
| 865 |
-
group_by(primary_name) %>%
|
| 866 |
-
summarise(
|
| 867 |
-
total_amt_bid = sum(amt_bid, na.rm = TRUE),
|
| 868 |
-
total_amt_booked = sum(amt_booked, na.rm = TRUE),
|
| 869 |
-
total_qty_bid = sum(qty_bid, na.rm = TRUE),
|
| 870 |
-
total_qty_booked = sum(qty_booked, na.rm = TRUE),
|
| 871 |
-
.groups = "drop"
|
| 872 |
-
) %>%
|
| 873 |
-
filter(total_qty_bid >= 3) %>% # exclude trivial sample sizes
|
| 874 |
-
mutate(
|
| 875 |
-
win_rate_sm = ifelse(total_amt_bid > 0, total_amt_booked / total_amt_bid, NA_real_),
|
| 876 |
-
avg_bid_size = ifelse(total_qty_bid > 0, total_amt_bid / total_qty_bid, NA_real_),
|
| 877 |
-
avg_booked_size = ifelse(total_qty_booked > 0, total_amt_booked / total_qty_booked, NA_real_)
|
| 878 |
-
)
|
| 879 |
-
|
| 880 |
-
# Prefer lag-adjusted win rate when available (mirrors K-Means behaviour)
|
| 881 |
-
if (!is.null(lwr) && nrow(lwr) > 0) {
|
| 882 |
-
lag_summary <- lwr %>%
|
| 883 |
-
group_by(primary_name) %>%
|
| 884 |
-
summarise(win_rate_lag = sum(lag_booked_amt, na.rm = TRUE) / sum(amt_bid, na.rm = TRUE),
|
| 885 |
-
.groups = "drop")
|
| 886 |
-
agg <- agg %>%
|
| 887 |
-
left_join(lag_summary, by = "primary_name") %>%
|
| 888 |
-
mutate(win_rate = coalesce(win_rate_lag, win_rate_sm)) %>%
|
| 889 |
-
select(-win_rate_lag, -win_rate_sm)
|
| 890 |
-
} else {
|
| 891 |
-
agg <- agg %>% rename(win_rate = win_rate_sm)
|
| 892 |
-
}
|
| 893 |
-
|
| 894 |
-
agg %>% filter(!is.na(win_rate), !is.infinite(win_rate),
|
| 895 |
-
!is.na(avg_bid_size), !is.infinite(avg_bid_size))
|
| 896 |
-
})
|
| 897 |
-
|
| 898 |
-
output$scatter_plot <- renderPlotly({
|
| 899 |
-
df <- scatter_agg()
|
| 900 |
-
validate(need(nrow(df) > 0, "No estimators meet the minimum bid threshold for the selected period."))
|
| 901 |
-
|
| 902 |
-
# ── Axis / size column resolution ────────────────────────────────────
|
| 903 |
-
x_col <- input$scatter_x
|
| 904 |
-
y_col <- input$scatter_y
|
| 905 |
-
size_col <- input$scatter_size
|
| 906 |
-
|
| 907 |
-
axis_labels <- c(
|
| 908 |
-
avg_bid_size = "Avg Bid Size ($)",
|
| 909 |
-
total_amt_bid = "Total Bid Volume ($)",
|
| 910 |
-
total_qty_bid = "Bid Count",
|
| 911 |
-
win_rate = "Win Rate (%)",
|
| 912 |
-
avg_booked_size = "Avg Booked Size ($)",
|
| 913 |
-
total_amt_booked = "Total Booked Volume ($)"
|
| 914 |
-
)
|
| 915 |
-
|
| 916 |
-
x_vals <- df[[x_col]]
|
| 917 |
-
y_vals <- df[[y_col]]
|
| 918 |
-
size_vals <- df[[size_col]]
|
| 919 |
-
|
| 920 |
-
# Guard: if avg_booked_size is all NA (no bookings in period), fall back gracefully
|
| 921 |
-
validate(need(!all(is.na(y_vals)), paste0("No data available for Y axis: ", axis_labels[y_col])))
|
| 922 |
-
validate(need(!all(is.na(size_vals)), paste0("No data available for size: ", axis_labels[size_col])))
|
| 923 |
-
|
| 924 |
-
# Normalise bubble size to a sensible pixel range (10–55px)
|
| 925 |
-
size_norm <- scales::rescale(replace_na(size_vals, 0), to = c(10, 55))
|
| 926 |
-
|
| 927 |
-
# ── Hover text ───────────────────────────────────────────────────────
|
| 928 |
-
fmt_val <- function(vals, col_id) {
|
| 929 |
-
lbl <- axis_labels[col_id]
|
| 930 |
-
if (grepl("\\$", lbl)) dollar(vals, accuracy = 1)
|
| 931 |
-
else if (col_id == "win_rate") paste0(round(vals * 100, 1), "%")
|
| 932 |
-
else comma(vals, accuracy = 1)
|
| 933 |
-
}
|
| 934 |
-
|
| 935 |
-
hover_text <- paste0(
|
| 936 |
-
"<b>", df$primary_name, "</b><br>",
|
| 937 |
-
axis_labels[x_col], ": ", fmt_val(x_vals, x_col), "<br>",
|
| 938 |
-
axis_labels[y_col], ": ", fmt_val(y_vals, y_col), "<br>",
|
| 939 |
-
axis_labels[size_col], " (bubble): ", fmt_val(size_vals, size_col), "<br>",
|
| 940 |
-
"Bids submitted: ", comma(df$total_qty_bid, accuracy = 1), "<br>",
|
| 941 |
-
"Bids won: ", comma(df$total_qty_booked, accuracy = 1)
|
| 942 |
-
)
|
| 943 |
-
|
| 944 |
-
# ── AdminLTE-matching palette — one colour per estimator ─────────────
|
| 945 |
-
palette_hex <- c("#3c8dbc", "#00a65a", "#f39c12", "#dd4b39",
|
| 946 |
-
"#605ca8", "#d81b60", "#00c0ef", "#39cccc",
|
| 947 |
-
"#ff851b", "#b0bec5")
|
| 948 |
-
dot_colors <- palette_hex[(seq_len(nrow(df)) - 1L) %% length(palette_hex) + 1L]
|
| 949 |
-
|
| 950 |
-
# ── Y-axis tick format ───────────────────────────────────────────────
|
| 951 |
-
y_tickformat <- if (y_col == "win_rate") ".1%"
|
| 952 |
-
else if (grepl("\\$", axis_labels[y_col])) "$,.0f"
|
| 953 |
-
else ""
|
| 954 |
-
x_tickformat <- if (grepl("\\$", axis_labels[x_col])) "$,.0f"
|
| 955 |
-
else ""
|
| 956 |
-
|
| 957 |
-
# ── Build plotly ─────────────────────────────────────────────────────
|
| 958 |
-
plot_ly(
|
| 959 |
-
data = df,
|
| 960 |
-
x = ~x_vals,
|
| 961 |
-
y = ~y_vals,
|
| 962 |
-
text = ~hover_text,
|
| 963 |
-
hoverinfo = "text",
|
| 964 |
-
type = "scatter",
|
| 965 |
-
mode = "markers+text",
|
| 966 |
-
marker = list(
|
| 967 |
-
size = size_norm,
|
| 968 |
-
color = dot_colors,
|
| 969 |
-
opacity = 0.85,
|
| 970 |
-
line = list(color = "rgba(255,255,255,0.3)", width = 1.2)
|
| 971 |
-
),
|
| 972 |
-
texttemplate = "%{text}", # plotly ignores this for hoverinfo="text"; set separately
|
| 973 |
-
showlegend = FALSE
|
| 974 |
-
) %>%
|
| 975 |
-
# Estimator name labels floating above each bubble
|
| 976 |
-
add_text(
|
| 977 |
-
x = ~x_vals,
|
| 978 |
-
y = ~y_vals,
|
| 979 |
-
text = ~primary_name,
|
| 980 |
-
textposition = "top center",
|
| 981 |
-
textfont = list(size = 10, color = "#444444"),
|
| 982 |
-
hoverinfo = "none",
|
| 983 |
-
showlegend = FALSE
|
| 984 |
-
) %>%
|
| 985 |
-
layout(
|
| 986 |
-
paper_bgcolor = "rgba(0,0,0,0)",
|
| 987 |
-
plot_bgcolor = "rgba(0,0,0,0)",
|
| 988 |
-
font = list(color = "#2c3e50", family = "Source Sans Pro, sans-serif"),
|
| 989 |
-
xaxis = list(
|
| 990 |
-
title = axis_labels[x_col],
|
| 991 |
-
gridcolor = "rgba(0,0,0,0.06)",
|
| 992 |
-
zerolinecolor = "rgba(0,0,0,0.15)",
|
| 993 |
-
tickformat = x_tickformat,
|
| 994 |
-
titlefont = list(size = 12, color = "#2c3e50")
|
| 995 |
-
),
|
| 996 |
-
yaxis = list(
|
| 997 |
-
title = axis_labels[y_col],
|
| 998 |
-
gridcolor = "rgba(0,0,0,0.06)",
|
| 999 |
-
zerolinecolor = "rgba(0,0,0,0.15)",
|
| 1000 |
-
tickformat = y_tickformat,
|
| 1001 |
-
titlefont = list(size = 12, color = "#2c3e50")
|
| 1002 |
-
),
|
| 1003 |
-
showlegend = FALSE,
|
| 1004 |
-
margin = list(t = 30, r = 20, b = 60, l = 80),
|
| 1005 |
-
hoverlabel = list(
|
| 1006 |
-
bgcolor = "#2c3e50",
|
| 1007 |
-
bordercolor = "#3c8dbc",
|
| 1008 |
-
font = list(color = "#ffffff", size = 12)
|
| 1009 |
-
)
|
| 1010 |
-
) %>%
|
| 1011 |
-
config(
|
| 1012 |
-
displayModeBar = TRUE,
|
| 1013 |
-
modeBarButtonsToRemove = c("lasso2d", "select2d", "autoScale2d"),
|
| 1014 |
-
displaylogo = FALSE
|
| 1015 |
-
)
|
| 1016 |
-
})
|
| 1017 |
-
|
| 1018 |
# ── ANNUAL, YOY, QUARTERLY ────────────────────────────────────────────────
|
| 1019 |
|
| 1020 |
output$annual_bar_chart <- renderPlotly({
|
|
@@ -1510,7 +1347,7 @@ function(input, output, session) {
|
|
| 1510 |
})
|
| 1511 |
}
|
| 1512 |
)
|
| 1513 |
-
|
| 1514 |
# ── IMS DATA FETCH ────────────────────────────────────────────────────────────
|
| 1515 |
|
| 1516 |
get_ims_data <- reactive({
|
|
@@ -1805,4 +1642,4 @@ function(input, output, session) {
|
|
| 1805 |
rownames = FALSE
|
| 1806 |
)
|
| 1807 |
})
|
| 1808 |
-
}
|
|
|
|
| 852 |
ggplotly(p, tooltip = "text")
|
| 853 |
})
|
| 854 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 855 |
# ── ANNUAL, YOY, QUARTERLY ────────────────────────────────────────────────
|
| 856 |
|
| 857 |
output$annual_bar_chart <- renderPlotly({
|
|
|
|
| 1347 |
})
|
| 1348 |
}
|
| 1349 |
)
|
| 1350 |
+
|
| 1351 |
# ── IMS DATA FETCH ────────────────────────────────────────────────────────────
|
| 1352 |
|
| 1353 |
get_ims_data <- reactive({
|
|
|
|
| 1642 |
rownames = FALSE
|
| 1643 |
)
|
| 1644 |
})
|
| 1645 |
+
}
|
ui.R
CHANGED
|
@@ -13,7 +13,6 @@ dashboardPage(
|
|
| 13 |
menuItem("Top Brief", tabName = "ceo_brief", icon = icon("briefcase")),
|
| 14 |
menuItem("Executive Dashboard", tabName = "dashboard", icon = icon("chart-area")),
|
| 15 |
menuItem("Intervention Analysis", tabName = "its", icon = icon("flask")),
|
| 16 |
-
menuItem("Estimator Scatter", tabName = "scatter", icon = icon("circle-dot")),
|
| 17 |
menuItem("Data Management", tabName = "admin", icon = icon("database")),
|
| 18 |
menuItem("Client Intelligence", tabName = "client_intel", icon = icon("handshake")),
|
| 19 |
hr(),
|
|
@@ -358,67 +357,8 @@ dashboardPage(
|
|
| 358 |
)
|
| 359 |
),
|
| 360 |
|
| 361 |
-
# ── ESTIMATOR SCATTER ────────────────────────────────────────────────
|
| 362 |
-
tabItem(tabName = "scatter",
|
| 363 |
-
|
| 364 |
-
fluidRow(
|
| 365 |
-
box(
|
| 366 |
-
title = "Estimator Scatter \u2014 Bid Behavior vs. Conversion",
|
| 367 |
-
width = 12,
|
| 368 |
-
status = "primary",
|
| 369 |
-
solidHeader = TRUE,
|
| 370 |
-
|
| 371 |
-
# ── Axis / bubble controls ────────────────────────────────
|
| 372 |
-
fluidRow(
|
| 373 |
-
column(4,
|
| 374 |
-
selectInput(
|
| 375 |
-
inputId = "scatter_x",
|
| 376 |
-
label = "X Axis",
|
| 377 |
-
choices = c(
|
| 378 |
-
"Avg Bid Size ($)" = "avg_bid_size",
|
| 379 |
-
"Total Bid Volume ($)" = "total_amt_bid",
|
| 380 |
-
"Bid Count" = "total_qty_bid"
|
| 381 |
-
),
|
| 382 |
-
selected = "avg_bid_size"
|
| 383 |
-
)
|
| 384 |
-
),
|
| 385 |
-
column(4,
|
| 386 |
-
selectInput(
|
| 387 |
-
inputId = "scatter_y",
|
| 388 |
-
label = "Y Axis",
|
| 389 |
-
choices = c(
|
| 390 |
-
"Win Rate (%)" = "win_rate",
|
| 391 |
-
"Avg Booked Size ($)" = "avg_booked_size",
|
| 392 |
-
"Total Booked Volume ($)" = "total_amt_booked"
|
| 393 |
-
),
|
| 394 |
-
selected = "win_rate"
|
| 395 |
-
)
|
| 396 |
-
),
|
| 397 |
-
column(4,
|
| 398 |
-
selectInput(
|
| 399 |
-
inputId = "scatter_size",
|
| 400 |
-
label = "Bubble Size",
|
| 401 |
-
choices = c(
|
| 402 |
-
"Total Bid Volume ($)" = "total_amt_bid",
|
| 403 |
-
"Bid Count" = "total_qty_bid",
|
| 404 |
-
"Total Booked ($)" = "total_amt_booked"
|
| 405 |
-
),
|
| 406 |
-
selected = "total_amt_bid"
|
| 407 |
-
)
|
| 408 |
-
)
|
| 409 |
-
),
|
| 410 |
-
|
| 411 |
-
# ── Plot ─────────────────────────────────────────────────
|
| 412 |
-
plotlyOutput("scatter_plot", height = "520px"),
|
| 413 |
-
|
| 414 |
-
# ── Footnote ─────────────────────────────────────────────
|
| 415 |
-
p(class = "text-muted", style = "font-size:11px; margin-top:6px;",
|
| 416 |
-
"Bubble area proportional to selected size metric. Win rate is same-month unless Lag > 0 is set in the sidebar, in which case the lag-adjusted rate is used. Estimators with fewer than 3 bids in the selected period are excluded. Hover for detail.")
|
| 417 |
-
)
|
| 418 |
-
)
|
| 419 |
-
),
|
| 420 |
-
|
| 421 |
# ── DATA MANAGEMENT ─────────────────────────────────────────────────
|
|
|
|
| 422 |
tabItem(tabName = "admin",
|
| 423 |
|
| 424 |
fluidRow(
|
|
@@ -448,161 +388,161 @@ dashboardPage(
|
|
| 448 |
)
|
| 449 |
),
|
| 450 |
tabItem(tabName = "client_intel",
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
pipeline activity, and award signals extracted from estimator field notes.
|
| 462 |
Data source: ", tags$code("bid___follow_up"), " joined to ",
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
'Estimators' mode shows how many different estimators have contacted each GC.")
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
Reveals pipeline activity intensity over time.")
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
Reveals which estimators own which GC relationships.")
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
until full bid outcome data is available.")
|
| 601 |
-
|
| 602 |
-
|
| 603 |
)
|
| 604 |
|
| 605 |
|
| 606 |
)
|
| 607 |
)
|
| 608 |
-
)
|
|
|
|
| 13 |
menuItem("Top Brief", tabName = "ceo_brief", icon = icon("briefcase")),
|
| 14 |
menuItem("Executive Dashboard", tabName = "dashboard", icon = icon("chart-area")),
|
| 15 |
menuItem("Intervention Analysis", tabName = "its", icon = icon("flask")),
|
|
|
|
| 16 |
menuItem("Data Management", tabName = "admin", icon = icon("database")),
|
| 17 |
menuItem("Client Intelligence", tabName = "client_intel", icon = icon("handshake")),
|
| 18 |
hr(),
|
|
|
|
| 357 |
)
|
| 358 |
),
|
| 359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
# ── DATA MANAGEMENT ─────────────────────────────────────────────────
|
| 361 |
+
|
| 362 |
tabItem(tabName = "admin",
|
| 363 |
|
| 364 |
fluidRow(
|
|
|
|
| 388 |
)
|
| 389 |
),
|
| 390 |
tabItem(tabName = "client_intel",
|
| 391 |
+
|
| 392 |
+
# ── HEADER NOTE ─────────��──────────────────────────────────────────────────
|
| 393 |
+
fluidRow(
|
| 394 |
+
box(
|
| 395 |
+
width = 12, status = "info", solidHeader = FALSE,
|
| 396 |
+
div(style = "padding:4px 0;",
|
| 397 |
+
p(style = "margin:0; font-size:13px; color:#2c3e50;",
|
| 398 |
+
icon("flask"), " ",
|
| 399 |
+
tags$b("Experimental Tab — "),
|
| 400 |
+
"Powered by IMS bid follow-up records. Shows contractor relationships,
|
| 401 |
pipeline activity, and award signals extracted from estimator field notes.
|
| 402 |
Data source: ", tags$code("bid___follow_up"), " joined to ",
|
| 403 |
+
tags$code("estimators"), "."
|
| 404 |
+
)
|
| 405 |
+
)
|
| 406 |
+
)
|
| 407 |
+
),
|
| 408 |
+
|
| 409 |
+
# ── ROW 1: KPIs ────────────────────────────────────────────��───────────────
|
| 410 |
+
fluidRow(
|
| 411 |
+
valueBoxOutput("ci_kpi_followups", width = 3),
|
| 412 |
+
valueBoxOutput("ci_kpi_contractors", width = 3),
|
| 413 |
+
valueBoxOutput("ci_kpi_top_est", width = 3),
|
| 414 |
+
valueBoxOutput("ci_kpi_date_range", width = 3)
|
| 415 |
+
),
|
| 416 |
+
|
| 417 |
+
# ── ROW 2: FILTERS ─────────────────────────────────────────────────────────
|
| 418 |
+
fluidRow(
|
| 419 |
+
box(
|
| 420 |
+
width = 12, status = "primary", solidHeader = TRUE,
|
| 421 |
+
title = "Filters",
|
| 422 |
+
fluidRow(
|
| 423 |
+
column(4,
|
| 424 |
+
pickerInput(
|
| 425 |
+
"ci_estimator", "Estimator",
|
| 426 |
+
choices = NULL, multiple = TRUE,
|
| 427 |
+
options = list(
|
| 428 |
+
`actions-box` = TRUE,
|
| 429 |
+
`live-search` = TRUE,
|
| 430 |
+
`selected-text-format` = "count > 2",
|
| 431 |
+
`count-selected-text` = "{0} Selected",
|
| 432 |
+
`none-selected-text` = "All Estimators"
|
| 433 |
+
)
|
| 434 |
+
)
|
| 435 |
+
),
|
| 436 |
+
column(4,
|
| 437 |
+
dateRangeInput(
|
| 438 |
+
"ci_date_range", "Date Range",
|
| 439 |
+
start = Sys.Date() %m-% months(36),
|
| 440 |
+
end = Sys.Date(),
|
| 441 |
+
separator = " to "
|
| 442 |
+
)
|
| 443 |
+
),
|
| 444 |
+
column(4,
|
| 445 |
+
pickerInput(
|
| 446 |
+
"ci_contractor", "Contractor (GC)",
|
| 447 |
+
choices = NULL, multiple = TRUE,
|
| 448 |
+
options = list(
|
| 449 |
+
`actions-box` = TRUE,
|
| 450 |
+
`live-search` = TRUE,
|
| 451 |
+
`selected-text-format` = "count > 2",
|
| 452 |
+
`none-selected-text` = "All Contractors"
|
| 453 |
+
)
|
| 454 |
+
)
|
| 455 |
+
)
|
| 456 |
+
)
|
| 457 |
+
)
|
| 458 |
+
),
|
| 459 |
+
|
| 460 |
+
# ── ROW 3: TOP CONTRACTORS + ACTIVITY TIMELINE ─────────────────────────────
|
| 461 |
+
fluidRow(
|
| 462 |
+
box(
|
| 463 |
+
title = "Top Contractors by Follow-Up Activity",
|
| 464 |
+
status = "primary", solidHeader = TRUE, width = 6,
|
| 465 |
+
fluidRow(
|
| 466 |
+
column(6,
|
| 467 |
+
radioGroupButtons(
|
| 468 |
+
"ci_contractor_metric", NULL,
|
| 469 |
+
choices = c("Follow-Ups" = "followups", "Estimators" = "estimators"),
|
| 470 |
+
selected = "followups",
|
| 471 |
+
status = "default", size = "xs", justified = TRUE
|
| 472 |
+
)
|
| 473 |
+
),
|
| 474 |
+
column(6,
|
| 475 |
+
sliderInput(
|
| 476 |
+
"ci_top_n", "Show Top N",
|
| 477 |
+
min = 5, max = 25, value = 15, step = 5, ticks = FALSE
|
| 478 |
+
)
|
| 479 |
+
)
|
| 480 |
+
),
|
| 481 |
+
plotlyOutput("ci_contractor_chart", height = "380px"),
|
| 482 |
+
p(class = "text-muted", style = "font-size:11px;",
|
| 483 |
+
"Bars show total follow-up contacts per GC across all selected estimators.
|
| 484 |
'Estimators' mode shows how many different estimators have contacted each GC.")
|
| 485 |
+
),
|
| 486 |
+
|
| 487 |
+
box(
|
| 488 |
+
title = "Follow-Up Activity Timeline",
|
| 489 |
+
status = "primary", solidHeader = TRUE, width = 6,
|
| 490 |
+
fluidRow(
|
| 491 |
+
column(6,
|
| 492 |
+
radioGroupButtons(
|
| 493 |
+
"ci_timeline_grain", NULL,
|
| 494 |
+
choices = c("Monthly" = "month", "Quarterly" = "quarter"),
|
| 495 |
+
selected = "month",
|
| 496 |
+
status = "default", size = "xs", justified = TRUE
|
| 497 |
+
)
|
| 498 |
+
),
|
| 499 |
+
column(6,
|
| 500 |
+
radioGroupButtons(
|
| 501 |
+
"ci_timeline_mode", NULL,
|
| 502 |
+
choices = c("Aggregate" = "agg", "By Estimator" = "ind"),
|
| 503 |
+
selected = "agg",
|
| 504 |
+
status = "default", size = "xs", justified = TRUE
|
| 505 |
+
)
|
| 506 |
+
)
|
| 507 |
+
),
|
| 508 |
+
plotlyOutput("ci_timeline_chart", height = "380px"),
|
| 509 |
+
p(class = "text-muted", style = "font-size:11px;",
|
| 510 |
+
"Monthly or quarterly count of follow-up contacts logged.
|
| 511 |
Reveals pipeline activity intensity over time.")
|
| 512 |
+
)
|
| 513 |
+
),
|
| 514 |
+
|
| 515 |
+
# ── ROW 4: ESTIMATOR × CONTRACTOR MATRIX + AWARD FEED ─────────────────────
|
| 516 |
+
fluidRow(
|
| 517 |
+
box(
|
| 518 |
+
title = "Estimator \u00d7 Contractor Relationship Matrix",
|
| 519 |
+
status = "primary", solidHeader = TRUE, width = 5,
|
| 520 |
+
plotlyOutput("ci_matrix_chart", height = "400px"),
|
| 521 |
+
p(class = "text-muted", style = "font-size:11px;",
|
| 522 |
+
"Heatmap of follow-up contacts. Darker = stronger relationship.
|
| 523 |
Reveals which estimators own which GC relationships.")
|
| 524 |
+
),
|
| 525 |
+
|
| 526 |
+
box(
|
| 527 |
+
title = "Award Signal Feed \u2014 Notes containing win/award language",
|
| 528 |
+
status = "warning", solidHeader = TRUE, width = 7,
|
| 529 |
+
fluidRow(
|
| 530 |
+
column(12,
|
| 531 |
+
p(style = "font-size:12px; color:#5A6A72; margin-bottom:6px;",
|
| 532 |
+
"Filtered for notes containing: ",
|
| 533 |
+
tags$b("awarded, booked, proceed, LOI, notice to proceed, doing this project, re-awarded")
|
| 534 |
+
)
|
| 535 |
+
)
|
| 536 |
+
),
|
| 537 |
+
dataTableOutput("ci_award_feed"),
|
| 538 |
+
p(class = "text-muted", style = "font-size:11px; margin-top:6px;",
|
| 539 |
+
"Award signals extracted from IMS follow-up notes. Use as a win log proxy
|
| 540 |
until full bid outcome data is available.")
|
| 541 |
+
)
|
| 542 |
+
)
|
| 543 |
)
|
| 544 |
|
| 545 |
|
| 546 |
)
|
| 547 |
)
|
| 548 |
+
)
|