Fix Mean Citedness tab: outcome classification, denominators, caching - #4
Fix Mean Citedness tab: outcome classification, denominators, caching#4LukasWallrich wants to merge 3 commits into
Conversation
R (scripts/render_impact_factor.R):
- Port the frontend classifyOutcome() fuzzy logic to an R helper
classify_outcome() and use it for overview counts, histogram bins,
and GAM subset/binary coding. Previously the R script used exact
string equality (outcome == "successful"), dropping label variants
("success", "failure", "successful || success", "statistically
successful but flawed", etc.), so tabs disagreed.
- Emit n_classified (successful/failed/mixed) so percentages divide by
the classified set, not n_total (which includes ~20
uninformative/descriptive rows and understated the rates).
- Drop the dead "inconclusive" category (no label maps to it) from the
overview and histogram output.
Frontend (assets/app.js):
- Divide Mean Citedness percentages by n_classified.
- Remove the always-zero Inconclusive series from the distribution chart.
- Guard loadMeanCitedness with window._mcData so the tab fetches and
renders once, matching the Authorship Overlap tab.
- Compute GAM scatter jitter once per data load (window._mcJitter) so
points no longer jump on every re-render.
scripts/run_fect.R:
- Build the t=-1 reference row from an existing emfx row so it carries
all columns (extras NA-filled), instead of rbinding a 5-column
data.frame that mismatched and errored under the tryCatch.
Regenerated impact_factor_data.json: successful 921->970, failed
826->851 (mixed unchanged), reflecting the recovered variants.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The guard checked window._mcData but nothing assigned it, so the tab still re-fetched on every visit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…light fetch Cached tab visits now return immediately (charts persist in the DOM; theme toggles re-render via _rerenderAllCharts). An in-flight flag prevents duplicate fetches from rapid tab switching, reset in finally so a failed load can be retried. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Codex review (gpt, read-only): REQUEST_CHANGES — the statistics were verified clean; two caching findings, both addressed:
Codex verified everything else in detail: the R classifier is a faithful port (including (Also fixed during self-review before codex ran: the original guard checked |
|
Codex re-verified the caching fixes: |
Part of a repo audit. The Mean Citedness tab disagreed with the rest of the dashboard about which studies count as successful/failed:
render_impact_factor.Rused exact string equality (== "successful"), silently dropping variant labels ("success", "failure", "successful || success", "statistically successful but flawed", …) that the frontend'sclassifyOutcome()catches. The R script now uses a faithful port of that JS function, so all tabs agree. Effect on the committed data: n_success 921→970 (+49), n_failed 826→851 (+25).n_total, which includes ~20 unclassifiable rows ("na", "uninformative", "descriptive only"). The R script now emitsn_classifiedand the frontend divides by it.run_fect.R(dormant): the t=−1 reference row is now built from an existingemfxrow instead of rbinding a 5-column data.frame that errors on column mismatch.data/impact_factor_data.jsonwas regenerated locally with the fixed script (R + mgcv); CI regenerates weekly.node --checkpasses on app.js.🤖 Generated with Claude Code