feat: v14.0 citation audit filters + network node sizing (#135, #145)#168
Merged
seanthimons merged 4 commits intomainfrom Mar 20, 2026
Merged
feat: v14.0 citation audit filters + network node sizing (#135, #145)#168seanthimons merged 4 commits intomainfrom
seanthimons merged 4 commits intomainfrom
Conversation
#145 — Citation audit filters and controls: - Add FWCI column to citation_audit_results (migration 011) - Carry FWCI through enrich_ranked_with_metadata pipeline - ASC/DESC sort toggle, FWCI as 4th sort option - Year range, min citations, min FWCI, min frequency filters - FWCI column in results table with color-coded values #135 — Changing citation size by new calculation metric: - Capture FWCI in network node data (seed, discovered, all frames) - New get_sizing_metric() with 4 modes: citations, age-weighted, FWCI, connectivity (degree) - Sizing dropdown in network controls, live re-size via proxy - FWCI shown in node tooltips when available 23 new unit tests for compute_node_sizes, get_sizing_metric, and enrich_ranked_with_metadata FWCI handling.
There was a problem hiding this comment.
Pull request overview
Adds citation audit sorting/filtering controls and expands citation-network node sizing options, while propagating FWCI through the audit + network pipelines to support FWCI-based UI features.
Changes:
- Add FWCI support end-to-end: DB schema/migration, audit enrichment, and network node/tooltips.
- Add citation audit UI controls for sort direction + filters (year range, min citations, min FWCI, min frequency).
- Add network node sizing modes (citations / age-weighted / FWCI / connectivity) with live resizing + new unit tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
tests/testthat/test-citation-network.R |
New unit tests for node sizing + sizing-metric selection + FWCI propagation in audit enrichment. |
migrations/011_add_fwci_to_audit_results.sql |
Migration intended to add fwci column to citation_audit_results. |
R/db.R |
Adds fwci column to citation_audit_results schema + persists FWCI when saving audit results. |
R/citation_audit.R |
Ensures fwci is included when enriching ranked audit results with metadata. |
R/mod_citation_audit.R |
Adds sorting direction + filtering UI and logic, plus optional FWCI column display. |
R/citation_network.R |
Adds FWCI to network node data, introduces sizing-metric helper, supports FWCI tooltip line. |
R/mod_citation_network.R |
Adds sizing dropdown UI and observer to live-update node sizes via proxy updates. |
README.md |
Documents node sizing modes and audit filters; updates file tree to mention audit modules. |
TODO.md |
Marks issues #135 and #145 as completed and adds them to the completed list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
R/mod_citation_audit.R
Outdated
| } | ||
| } | ||
| # Min collection frequency filter | ||
| if (!is.null(input$min_frequency) && input$min_frequency > 2) { |
R/mod_citation_audit.R
Outdated
Comment on lines
+454
to
+471
| has_fwci_data <- "fwci" %in% names(results) && any(!is.na(results$fwci)) | ||
|
|
||
| # Compute year bounds for filter | ||
| all_results <- audit_results() | ||
| valid_years <- all_results$year[!is.na(all_results$year)] | ||
| yr_bounds <- if (length(valid_years) > 0) { | ||
| c(min(valid_years), max(valid_years)) | ||
| } else { | ||
| c(1900L, as.integer(format(Sys.Date(), "%Y"))) | ||
| } | ||
|
|
||
| # Sort choices — include FWCI only if data exists | ||
| sort_choices <- c("Collection Frequency" = "collection_frequency", | ||
| "Global Citations" = "cited_by_count", | ||
| "Year" = "year") | ||
| if (has_fwci_data) { | ||
| sort_choices <- c(sort_choices, "FWCI" = "fwci") | ||
| } |
| "collection_frequency" = results[order(results$collection_frequency, decreasing = sort_desc), ], | ||
| "cited_by_count" = results[order(results$cited_by_count, decreasing = sort_desc), ], | ||
| "year" = results[order(results$year, decreasing = sort_desc, na.last = TRUE), ], | ||
| "fwci" = results[order(results$fwci, decreasing = sort_desc, na.last = TRUE), ], |
Comment on lines
+428
to
+434
| selectInput( | ||
| ns("size_by"), | ||
| tags$span("Size Nodes By", | ||
| title = "Control what determines node size. Age-weighted divides citations by paper age to surface newer impactful papers."), | ||
| choices = choices, | ||
| selected = "citations" | ||
| ) |
| if (has_fwci) { | ||
| sprintf("FWCI available for %d of %d nodes", fwci_count, nrow(net_data$nodes)) | ||
| } else { | ||
| "FWCI not available for network nodes (only returned by some OpenAlex endpoints)" |
Comment on lines
586
to
+592
| # Cube-root transform: better spread than log1p for power-law data. | ||
| # cbrt(100)=4.6, cbrt(1000)=10, cbrt(15000)=24.7 | ||
| # Gives 5x visual difference between 1k and 15k citations | ||
| # (log1p only gives 1.4x — high-citation nodes look the same) | ||
| transformed <- pmax(cited_by_counts, 0)^(1/3) | ||
| safe_values <- pmax(values, 0, na.rm = TRUE) | ||
| safe_values[is.na(safe_values)] <- 0 | ||
| transformed <- safe_values^(1/3) |
| -- Supports filtering/sorting audit results by field-weighted citation impact | ||
| -- Pattern matches v13's refiner_results table which already stores FWCI | ||
|
|
||
| ALTER TABLE citation_audit_results ADD COLUMN fwci DOUBLE; |
This was referenced Mar 19, 2026
- Make migration 011 idempotent with IF NOT EXISTS (fresh DB crash) - Compute has_fwci_data from unfiltered results (UI flicker fix) - Fix min-frequency filter threshold (> 1 instead of > 2)
This was referenced Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
log1pscaling for orders-of-magnitude differencesTest plan
test-citation-network.R)Closes #135, closes #145