International Sensor Development Project: This project is a voting system that uses a raspberry pi server and multiple voting devices. The system is easy, secure, scalable, and supports anonymous and registered voting. This repository focuses on the Raspberry Pi server.
This function receives a JSON object detailing vote distribution retrieved from a database query. Its purpose is to process this data, calculate various statistics, and compile them into a structured JSON object.
Statistics to calculate
Majority: Determines whether the yes or no votes obtained more than 50% + 1 of the total votes.
Vote Rates: Includes percentages of yes, no, and abstain votes.
Various Majority Types: Simple, absolute, and supermajority conditions.
Consensus: Flags indicating whether yes or no votes achieved consensus.
Various Majorities
Simple Majority: Requires 50% + 1 of counted votes (abstain votes are not taken into account).
Absolute Majority: Requires 50% + 1 of ALL votes (abstain votes are counted).
Super majority: Contains conditions:
"2 3": Flags if a vote received two-thirds of the vote.
"3 4": Flags if a vote received three-fourths of the vote.
"4 5": Flags if a vote received four-fifths of the vote.
Vote Result Analytics Function
Goal
This function receives a JSON object detailing vote distribution retrieved from a database query. Its purpose is to process this data, calculate various statistics, and compile them into a structured JSON object.
Statistics to calculate
Various Majorities
Super majority: Contains conditions:
Return JSON format
}, "consensus":{ "yes":false, "no":false } }
Arguments
JSON Object: Contains the count of voters and the count of specified votes (yes, no, abstain).
Returns
JSON Object: Contains all calculated statistics pertinent to the specified vote.
Function Name:
calculateVoteStatistics