This project is not covered by Drupal’s security advisory policy.

Election Archive is a companion module for the Election 3.x framework that manages the long-term cold-storage lifecycle of formal ballots and high-turnout organisational elections.

In large or recurring elections, the election_vote SQL table can grow to millions of rows. Election Archive prevents database bloat by verifying vote hash chains, exporting a self-contained audit package to remote Flysystem storage (such as Amazon S3 / S3 Glacier, Google Cloud Storage, or local archive storage), and only then purging active vote rows in bounded chunks.

Features

  • Automated Retention Lifecycle: Configure per-Election-Type retention periods so closed or certified elections are automatically discovered on cron and queued for archiving without duplicates.
  • Verify-Before-Purge Safety: Verifies each question's sequential SHA-256 vote hash chain (H0..Hn) before export (enabled by default; aborts immediately if tampering or a broken chain is detected) and confirms remote archive persistence before deleting active election_vote records.
  • Remote Storage via Flysystem: Supports any configured Flysystem stream wrapper (e.g., s3://archive, gcs://ballots, or a dedicated local scheme) with configurable path prefixes.
  • Batched & Chunked Processing: Uses Drupal's Batch and Queue APIs with a configurable chunk size (default 500 votes per chunk) to archive and purge large elections without memory spikes or timeouts.
  • Clean Active vs. Archived Separation: Separates archived elections into a dedicated Archived Elections view (/election/archived) with artifact manifest inspection and controlled downloads.
  • Granular Permissions: Dedicated permissions for configuring archive settings (administer election archive settings), triggering archiving (archive election entities), and viewing/downloading archived artifacts (access archived election artifacts).

Generated Audit Artifacts

To support independent scrutineers and organisational record-keeping after active vote records are purged, each archived election generates a manifest and three sealed artifact types:

Artifact Format Purpose
Ballot Tally Data .blt Standard BLT ballot format export for STV and preferential elections, allowing scrutineers to independently re-run counts in external engines (such as Election Condorcet / Condorcet PHP or OpenSTV).
Vote Ledger .json Sequential export of every vote's sequence number, single-use token digest, decoupled ballot payload, weight, timestamp, previous hash, and SHA-256 vote hash for verifying hash-chain continuity against witnessed chain heads.
Official Result .pdf Human-readable snapshot of the election_result tally and certification metadata with an optional embedded cryptographic signature seal (SHA-256, SHA-384, or SHA-512).

Requirements

  • Drupal: ^11 || ^12
  • PHP: ^8.3
  • Modules: Election (^3.0) and Flysystem (^3.0)
  • Recommended adapter: league/flysystem-aws-s3-v3 (or another Flysystem v3 adapter for off-server cold storage)

Installation

composer require drupal/election_archive
drush en election_archive

Configuration

  1. Configure your target Flysystem scheme in settings.php (for example, an s3://archive stream wrapper).
  2. Visit Administration > Election > Settings > Archiving (/admin/election/settings/archive) to set the Flysystem destination prefix, export/purge batch size, hash-chain verification toggle, and PDF sealing options.
  3. Configure retention periods on your Election Types for automated cron-based archiving, or manually archive a closed/certified election at /election/{election}/archive.

Related Projects

Supporting organizations: 

Project information

Releases