Repository navigation
feat: add web admin console for managing hypergraph databases - #12
Merged
Merged
Conversation
Add a browser-based admin console (`db.admin()`) on top of the existing viewer server: - Overview dashboard: counts, degree / hyperedge size distributions (log scale, geometric buckets for long tails), top vertices, entity types and attribute keys - Vertex and hyperedge tables with search, filtering, sorting and paging - Create, edit (JSON attribute editor) and delete vertices and hyperedges - HIF import / export and explicit save to the .hgdb file - Embedded graph viewer; the viewer now accepts ?vertex=<id> - Chinese / English UI switch (remembered per browser) - JSON REST API under /api/admin Also make the viewer's /api/graph resolve non-string vertex ids (e.g. ints), which previously never matched the string query parameter, and hide the `cluster` attribute in the viewer's detail panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Annotate HypergraphAPIHandler with BaseHypergraphDB (what the viewer already accepts), and have the admin look up to_hif / from_hif at runtime, returning 501 for database classes without HIF support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Adds a browser-based admin console for Hypergraph-DB. The existing visualization (
hg.draw()) is read-only; the console also lets you change data and inspect the database.Features
remove_v()semantics..hgdbfile. Edits stay in memory until saved, and the page warns before you leave with unsaved changes.?vertex=<id>, so a vertex's detail view links straight to its graph./api/admin/*, which the UI uses and scripts can call too.Implementation
hyperdb/admin.py:HypergraphAdminHandlerextends the existingHypergraphAPIHandler, so the viewer endpoints keep working at/viewer. It uses only the standard library. The server is single-threaded on purpose, sinceHypergraphDBis not thread-safe.hyperdb/templates/admin.html: a single-page app in the same React + Tailwind (CDN) stack as the viewer, with library versions pinned.BaseHypergraphDB.admin(port=8900, open_browser=True, blocking=True, host="127.0.0.1").Other changes
draw.py:/api/graphnow resolves non-string vertex IDs. Query parameters are always strings, so vertices with int IDs could never be shown in the viewer before.clusterattribute is now hidden in the detail panel.Notes
127.0.0.1by default, and the README says so.HypergraphDB.nbr_v()raisesKeyErrorfor isolated vertices, because it removesv_idfrom an empty set. The console works around it.Test plan
tests/test_admin.py: 8 tests against a live server on an ephemeral port, covering pages, info and stats, listing and search ranking, vertex and hyperedge CRUD (merge vs. replace, 404/409/400), save round-trip, HIF import and export, bad requests, and non-string IDs in the viewer API.sanguo.hgdb(4.3K vertices) andneurology.hgdb(25K vertices; list and stats API calls take 0.06–0.15s).🤖 Generated with Claude Code