This document explains the Kuadratic val, a voting component that can be deployed on val.town. It exports an HTML component which displays one or more selectable voting elements and allows users to cast votes. Voting results are stored in the val.town SQLite database while enforcing limits on the number of votes both per element and per individual.
Kuadratic is a val that provides an embeddable voting widget for HTML pages. Key features include:
• Multiple Options: The component is capable of displaying more than one voteable element (or option) on the same page.
• Persistent Storage: All vote data is persisted in the val.town SQLite database, ensuring that votes are durable and can be retrieved or analyzed later.
• Vote Count Limiting: Each HTML instance using the component has a capped total number of votes. This setting prevents any single poll from being overloaded with votes and helps to maintain fair voting practices.
• Individual Vote Limits: The component enforces a limit on the number of votes an individual can cast. This helps maintain balanced participation and prevents abuse. Vote attribution (e.g., via IP check, device cookies, or user tokens) is integrated to track or limit individual participation.
HTML Component Exportation:
Voting Process:
Vote Count & Validity Checks:
Data Persistence:
The exported component generally consists of:
The component communicates with a minimal API that includes endpoints to:
Database Schema:
A typical schema might include tables for:
votes
(columns: id, option_id, voter_id, timestamp)options
(columns: option_id, description, vote_count)Query Handling:
The val code will:
votes
table.To deploy the Kuadratic val:
• Ensure the hosting environment supports val.town’s mechanism for exporting HTML components and connecting to the SQLite database.
• Configure the vote limits (global and per-user) in your val settings.
• Embed the exported HTML component onto your target webpage using the provided script or iframe.
• Monitor the SQLite database to verify that votes are being recorded properly and that limits are enforced as expected.
Kuadratic offers a robust and secure way to integrate user voting on websites via an exported HTML component. Its features — including multiple voteable elements, enforced vote count restrictions, and persistent storage using val.town’s SQLite database — ensure both ease of integration and data integrity. This document serves as a guide for developers to understand and implement the Kuadratic voting component seamlessly within their val.town environment.