Skip to content

Add more column options to p-adic field dynamic statistics#27

Open
roed-math wants to merge 2 commits into
mainfrom
ai/t25-lfstats-columns
Open

Add more column options to p-adic field dynamic statistics#27
roed-math wants to merge 2 commits into
mainfrom
ai/t25-lfstats-columns

Conversation

@roed-math

Copy link
Copy Markdown
Owner

The dynamic statistics page for p-adic fields previously offered only Galois
group and Galois Artin slopes as columns. This extends LFStats.dynamic_cols to
every searchable column (residue characteristic, degree, ramification index,
residue field degree, discriminant exponent, Galois group, automorphisms,
unramified/tame degree, top slope, Galois/visible/hidden slopes, indices of
inseparability, associated inertia, jump set), with display metadata and
click-through query formatters matched to the existing search boxes. Sort keys
map not-computed (NULL) values to sort first so columns with NULLs no longer
crash when selected unconstrained, and Galois-group handling tolerates fields
with no computed Galois group. Default p/c buckets are provided, and the
static statistics page is verified unchanged (discdisp pins empty buckets).
Links to "create your own" statistics are added from the browse index and the
statistics page. Adds tests covering the links and rendering of all new columns.
Addresses LMFDB#6542.

🤖 Generated with Claude Code

roed314 and others added 2 commits July 19, 2026 11:41
Extend LFStats.dynamic_cols from just galois_label/slopes to every
searchable column (p, n, e, f, c, galois_label, aut, u, t, top_slope,
slopes, visible, hidden, ind_of_insep, associated_inertia, jump_set), so
users can build their own statistics and click through to matching
searches.  Supporting display metadata (short_display, top_titles,
knowls, formatters, sort_keys, query_formatters, default p/c buckets) is
added to match the search boxes.  sort_keys map None to a first-sorting
sentinel so columns with NULLs (slopes, hidden, u, t, galois_label) no
longer crash when picked unconstrained; query_formatters emit valid
search URLs (topslope=, slopes=...&slopes_quantifier=exactly, empty
constraints for un-searchable values).  galformatter/galsortkey/galquery
now tolerate the 3,996 NULL galois_labels.  discdisp pins buckets={} so
the static /stats page is unchanged.  Links to the dynamic stats page are
added from the browse index (short_summary) and /stats (summary).

Verified: sage -python -m pytest lmfdb/local_fields/test_localfields.py
(10 passed, incl. new test_stats_pages/test_dynamic_stats); /padicField/stats
byte-identical to base except the added "create your own" link (fixed
PYTHONHASHSEED diff); formatter/sort-key/query-formatter sweep over all
distinct DB values of the new columns with no errors; new-style
click-through URLs resolve (e.g. slopes exact match returns 10 fields);
pyflakes clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mic stats (LMFDB#6542)

P2: the dynamic-statistics query_formatters encoded not-computed/null buckets
as empty url parameters (gal=, u=, slopes=, associated_inertia=), which the
search parsers silently ignore -- so clicking a null bucket's count opened an
UNFILTERED search returning every field instead of the counted records.  There
is no url-level null-search syntax (empty params are dropped; $exists:False is
not reachable from any parser used by common_parse), so the drill-down link is
now suppressed for such buckets.  The null query_formatters return a new
NO_SEARCH_QUERY sentinel; LFStats.display_data (via the testable
_suppress_null_links helper) blanks any assembled drill-down url containing it,
and stat_1d.html now guards the link with {% if c.query %} exactly as
stat_2d.html already did.

P3: formatbracketcol handled empty lists/strings but not None, so ind_of_insep/
associated_inertia could render a literal $None$ bucket label; None now maps to
the standard "not computed" presentation.

Verified (sage -python, devmirror): pytest lmfdb/local_fields/test_localfields.py
-> 12 passed, incl. two new tests (unit coverage of the sentinel query_formatters,
_suppress_null_links for counts+grid, and formatbracketcol(None/''/[]); page-level
coverage that the galois_label/slopes/hidden not-computed buckets render with no
empty-parameter link and no sentinel leak, while non-null buckets still filter
correctly).  Confirmed the not-computed galois_label bucket (3996 fields) now has
a blank query, and non-null drill-downs (p=2,n=4 -> 12 cyclic quartics; n x e)
still produce correct filtered links.  pyflakes clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@roed-math

Copy link
Copy Markdown
Owner Author

Addressed the external review's P2 and P3 findings: commit d120ea2.

P2 (null-bucket drill-downs): confirmed the parsers silently drop empty params and no null-search URL syntax exists, so suppression is the right policy. Null branches of the query formatters now return a NO_SEARCH_QUERY sentinel, LFStats blanks any drill-down containing it (via a testable helper), and stat_1d.html guards the count link the same way stat_2d.html already did. Concrete impact: the cached not-computed galois_label bucket (3,996 fields) previously linked to an unfiltered ~1.39M-row search; it now renders linkless.

P3: formatbracketcol(None) renders "not computed" instead of $None$.

12 local_fields tests pass (2 new); non-null drill-downs verified to still filter correctly; stayed clear of PR #26's hunks in the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants