Skip to content

This Dashrep-language code supports 1-2-3 ranking polls within a web app, including correctly identifing the popularity of the choices, and automatically generating a "newspaper" article that reports the results. The calculations are done using VoteFair ranking, which is a type of pairwise counting.

License

cpsolver/VoteFair-polls

Repository files navigation

VoteFair-polls

This code is used to support the polls in the NewHereNow.com web app.  These polls use VoteFair ranking to identify the popularity of the choices that appear on a ballot.

There are several kinds of code here:

* Most of the code in the "poll-specifications" folder specifies specific polls that are hosted at www.NewsHereNow.com.  This kind of code is edited manually and uses an easy-to-understand format.

* The code in the "balloting" folder converts the first kind of code into JSON-format files that are sent from the NewsHereNow.com server to a web browser that is displaying the NewsHereNow.com web app.  This kind of code is written in the Dashrep language and should not need to be edited after this code is working correctly.

* The code in the folders that begin with the word "calc", and the code in the "words-for-results-article" folder, transform saved ballot information into an automatically generated "newspaper" article that summarizes the popularity of the choices.  The generated article is merged into the JSON-format file explained above.  This kind of code is written in the Dashrep language.  The Dashrep code in the "calc" folders should not need to be edited after this code is working.  The Dashrep template code in the "words-for-results-article" folder needs to be edited to handle specific polls.

* The "VoteFairRanking.pm" file in the "calc-VoteFair-ranking-calculation-files" folder is a copy of the library file of the same name that is in the VoteFair-ranking repository within the CPSolver account at GitHub.com.  The "votefair_ranking_do_calcs.pl" file in the same folder is a short Perl script that passes the numbers-only poll data to and from the VoteFairRanking.pm library.

* The "sample_html_segment_ballot_code.txt" file is sample HTML code from a web app that displays the poll ballot.  This code is generated by other software.  The "balloting" code (explained above) uses this HTML code to display the poll ballot within the web app.

Usually required but not included:

* Dashrep-language and Javascript-language code named "javascript-function-ballot-encode-rankings.txt" and "javascript-function-ballot-initialize.txt" and "javascript-function-put-json-data-into-webpage.txt" in the Dashrep-language repository on GitHub -- within the "dashrep_code_for_web_app\javascript\javascript-utilities\" folder.  These files, which are written in the Dashrep language, expand into Javascript functions that control the web app's interactive ballot while the user is marking the ballot.  Alternative Javascript code can be used if it generates ballot data that is compatible with the "calc-polls-ballots-pre-counting" code.

For details about the Dashrep language, see www.Dashrep.org.

For details about the NewsHereNow.com web app, go to www.NewsHereNow.com.

For details about VoteFair ranking, see www.VoteFair.org, and the VoteFair-ranking repository on GitHub.

Version 1.00


COPYRIGHT AND LICENCE

Copyright (c) 2017-2018 Richard Fobes at www.VoteFair.org, all rights reserved.

You can redistribute and/or modify this library module
under the Perl Artistic License 2.0, a copy
of which is included in the LICENSE file.

Conversions of this code into other languages are also
covered by the above license terms.

The Dashrep (TM) name is trademarked by Richard Fobes at
www.Dashrep.org to prevent the name from being co-opted.

The Dashrep (TM) language is in the public domain.

About

This Dashrep-language code supports 1-2-3 ranking polls within a web app, including correctly identifing the popularity of the choices, and automatically generating a "newspaper" article that reports the results. The calculations are done using VoteFair ranking, which is a type of pairwise counting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published