Skip to content

API for [insert wiki] eligibility #199

@lgelauff

Description

@lgelauff

I've been looking at the account eligibility checker as a base for evaluating user eligibility against generic criteria — not tied to a specific upcoming election, but useful for ongoing moderation and community health work. This in the context of a prototype I'm working on, https://wiki-polis.toolforge.org . I could probably build it myself, but i prefer shared infrastructure, especially when maintaining eligibility tables together.

Two independent additions would make this possible.

  • API endpoint: Currently the tool only returns HTML. Adding a thin api.php endpoint that accepts the same query parameters (user, wiki, event) and returns structured JSON would open the tool to programmatic use — scripts, bots, dashboards — without touching any existing logic. The existing AccountEligibilityEngine already returns structured ResultInfo objects; the work is essentially a serializer and a new entry point. No changes to rules, the engine, or the current HTML interface.
  • New eligibility check table with a rolling cutoff date. Today all eligibility criteria are defined per named election in EventFactory, with fixed cutoff dates. I'd like to check whether someone is eligible to vote at, for example, nlwiki "stemlokaal" where the cutoff is dynamic — defaulting to today. The proposal is additive: leave EventFactory and all existing events completely untouched. Add a new custom mode that assembles an Event at runtime from query parameters the caller provides. Parameters the caller omits simply don't apply — no rule is required for every field.

Example query: ?mode=rolling&wiki=nlwikipedia&type=stemlokaal&cutoff=today

We could maintain the table for example on meta or commons, similar to the wikiloves stats tool and this data config table.

If you would be interested, I think I might be able to produce the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions