Skip to content

Add admincli report toolkit for period-bounded usage reports#1690

Merged
jcschaff merged 3 commits into
masterfrom
admin-report-toolkit
May 11, 2026
Merged

Add admincli report toolkit for period-bounded usage reports#1690
jcschaff merged 3 commits into
masterfrom
admin-report-toolkit

Conversation

@jcschaff
Copy link
Copy Markdown
Member

Summary

  • New admincli report subcommand kit (four single-purpose picocli commands) for NIH-RPPR-style usage metrics over arbitrary [start, end] windows.
  • SQL primitives on AdminDBTopLevel use Table-class Field.getQualifiedColName() references and PreparedStatement date binding rather than embedded literals.
  • Driver script tools/report/rppr-2026.sh runs the suite end-to-end against the vcell_dev role.
  • /admin-report slash-command skill documents the toolkit, the SLURM sacct caveat for the true count of jobs submitted to the compute cluster, and a checklist for adding new metrics next year.
  • .gitignore adds user-PII patterns (users_*.txt, users_*.csv, active_users*.csv) and tools/report/output/ so per-user lists with emails/names/affiliations stay local.

Why this shape

Next year's reporting request will likely have a different shape (different metrics, different groupings). Each command does one thing, so adding a new metric is one new SQL method + (for new categories) one new ~40-line command class. The count-asof command is enum-driven; adding a new as-of metric is one enum value plus a SQL branch — no new command class needed.

Commands

admincli report count-new-users      --start <date> --end <date>
admincli report count-sim-jobs-in-db --start <date> --end <date>
admincli report count-asof --metric <m> --asof <date>
admincli report list-active-users    --start <date> --end <date> [-o <file>]

Each count command emits the integer on stdout with a human-readable description on stderr; list-active-users emits CSV (userid,email,company,country,tld_extension).

Caveats documented in the code and skill

  • vc_simulationjob cascade-deletes when its parent simulation is removed/replaced, so count-sim-jobs-in-db is structurally unreliable for historical reporting. The true count of jobs submitted to the compute cluster lives in SLURM accounting (sacct). The skill markdown documents the exact sacct invocation.

Test plan

  • mvn compile test-compile -pl vcell-admin,vcell-server -am — BUILD SUCCESS
  • Smoke-tested against the live DB via the vcell_dev role for two periods (2024-04-01..2025-06-30 and 2025-07-01..2026-05-01); cumulative as-of numbers cross-check vs /api/v1/admin/usage snapshot
  • Verified user-PII files (users_*.txt, generated active_users*.csv, tools/report/output/) are excluded from git
  • Future: SLURM sacct integration is intentionally out of scope; documented as a separate one-line invocation on the HTC head node

🤖 Generated with Claude Code

jcschaff and others added 3 commits May 11, 2026 16:28
AdminDBTopLevel gains an AsOfMetric enum, an ActiveUser record, and four
period/asof query methods (countNewUsers, countSimJobsInDb, countAsOf,
listActiveUsersInPeriod) so callers can request NIH-RPPR-style metrics
for arbitrary [start, end] windows. Queries reference column names via
Table-class Field objects and bind dates with PreparedStatement.setDate
rather than embedding literals. CLIDatabaseService gets thin wrappers.

The cascade-delete behavior of vc_simulationjob is called out in the
countSimJobsInDb Javadoc since it makes that metric structurally
unreliable for historical reporting; SLURM sacct remains the source
of truth for jobs ever submitted to the compute cluster.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Four single-purpose picocli commands grouped under `admincli report`:
count-new-users, count-sim-jobs-in-db, count-asof, list-active-users.
Each command emits a single integer (or a CSV for list-active-users)
on stdout with a human-readable description on stderr, so they
compose cleanly in shell pipelines.

The modular shape is deliberate so next year's reporting request can
add a new metric with a single new SQL method (or just a new
AsOfMetric enum value) without touching the existing commands.

Package-info.java cross-references the .claude/commands/admin-report.md
slash-command skill for the toolkit overview and the cascade-delete /
SLURM caveats.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tools/report/rppr-2026.sh wraps the admincli `report` subcommands for the
NIH RPPR usage report. It expects DB credentials from environment
(VCELL_DB_URL / DRIVER / USER / PASSWORD — use the dev role, not the
service role) and assumes the Maven project is already built; the
script fails fast with a helpful message if vcell-admin/target/maven-jars
is missing rather than triggering a slow rebuild on every invocation.

The /admin-report slash-command skill documents what each metric means,
the SLURM sacct command for the true count of jobs submitted to the
compute cluster (vc_simulationjob is cascade-delete-eroded and not
reliable for historical reporting), and a checklist for adding new
metrics next year.

.gitignore adds tools/report/output/ plus user-PII patterns
(users_*.txt, users_*.csv, active_users*.csv) so per-user lists with
emails / names / affiliations stay local and are never committed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jcschaff jcschaff merged commit 3a97d37 into master May 11, 2026
13 checks passed
@jcschaff jcschaff deleted the admin-report-toolkit branch May 11, 2026 20:37
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.

1 participant