diff --git a/code/index.html b/code/index.html new file mode 100644 index 0000000..ccd82cc --- /dev/null +++ b/code/index.html @@ -0,0 +1,372 @@ + + +
+ + +This module provides support for auditing of a single plurality contest + over multiple jurisdictions using a Bayesian ballot-level + comparison audit.
+ +This module provides routines for computing the winning probabilities + for various choices, given audit sample data. Thus, this program + provides a risk-measuring functionality.
+ +More precisely, the code builds a Bayesian model of the unsampled + ballots, given the sampled ballots. This model is probabilistic, + since there is uncertainty about what the unsampled ballots are. + However, the model is generative: we generate many possible + sets of likely unsampled ballots, and report the probability that + various choices win the contest. (See References below for + more details.)
+ +The main output of the program is a report on the probability + that each choice wins, in these simulations.
+ +The contest may be single-jurisdiction or multi-jurisdiction. + More precisely, we assume that there are a number of "collections" + of ballots that may be sampled. Each relevant jurisdiction may + have one or more such collections. For example, a jurisdiction + may be a county, with one collection for ballots submitted by + mail, and one collection for ballots cast in-person.
+ +This module may be used for ballot-polling audits (where there + no reported choices for ballots) or "hybrid" audits (where some + collections have reported choices for ballots, and some have not).
+ +Descriptions of Bayesian auditing methods can be found in:
+The code for this tool is available on github at + www.github.com/ron-rivest/2018-bctool. + This web form provides exactly the same functionality as the stand-alone + Python tool + www.github.com/ron-rivest/2018-bctool/BCTool.py. + The Python tool + requires an environment set up with Python 3 and Numpy. + This web form was implemented using + + CherryPy + . +
(See www.github.com/ron-rivest/2018-bptool + for similar code for a Bayesian ballot-level polling audit. The code here was based + in part on that code.) +
+ + + + + + diff --git a/code/website.py b/code/website.py index c34e50b..2226cf0 100644 --- a/code/website.py +++ b/code/website.py @@ -11,378 +11,22 @@ import bctool +CODE_DIR = os.path.dirname(os.path.realpath(__file__)) -class BCToolPage: +# Serving static files with CherryPy is a bit kludgy no matter how you do it, +# so let's just do it directly: +# (If you'd like to be able to change the HTML with 'autoreloader', move this +# block into the definition of 'index'): +with open(os.path.join(CODE_DIR, 'index.html'), 'r') as content_file: + index_string = content_file.read() +class BCToolPage: @cherrypy.expose def index(self): # Ask for the parameters required for the Bayesian Audit. # Style parameters from # https://www.w3schools.com/css/tryit.asp?filename=trycss_forms - return ''' - -This module provides support for auditing of a single plurality contest - over multiple jurisdictions using a Bayesian ballot-level - comparison audit.
- -This module provides routines for computing the winning probabilities - for various choices, given audit sample data. Thus, this program - provides a risk-measuring functionality.
- -More precisely, the code builds a Bayesian model of the unsampled - ballots, given the sampled ballots. This model is probabilistic, - since there is uncertainty about what the unsampled ballots are. - However, the model is generative: we generate many possible - sets of likely unsampled ballots, and report the probability that - various choices win the contest. (See References below for - more details.)
- -The main output of the program is a report on the probability - that each choice wins, in these simulations.
- -The contest may be single-jurisdiction or multi-jurisdiction. - More precisely, we assume that there are a number of "collections" - of ballots that may be sampled. Each relevant jurisdiction may - have one or more such collections. For example, a jurisdiction - may be a county, with one collection for ballots submitted by - mail, and one collection for ballots cast in-person.
- -This module may be used for ballot-polling audits (where there - no reported choices for ballots) or "hybrid" audits (where some - collections have reported choices for ballots, and some have not).
- -Descriptions of Bayesian auditing methods can be found in:
-The code for this tool is available on github at - www.github.com/ron-rivest/2018-bctool. - This web form provides exactly the same functionality as the stand-alone - Python tool - www.github.com/ron-rivest/2018-bctool/BCTool.py. - The Python tool - requires an environment set up with Python 3 and Numpy. - This web form was implemented using - - CherryPy - . -
(See www.github.com/ron-rivest/2018-bptool - for similar code for a Bayesian ballot-level polling audit. The code here was based - in part on that code.)
- - - - - ''' + return index_string @cherrypy.expose def ComparisonAudit( @@ -531,9 +175,12 @@ def get_html_results(self, actual_choices, win_probs, n_winners): -server_conf = os.path.join(os.path.dirname(__file__), 'server_conf.conf') +server_conf = os.path.join(CODE_DIR, 'server_conf.conf') if __name__ == '__main__': + # cherrypy.tree.mount(BCToolPage(), config=server_conf) + # cherrypy.engine.start() + # cherrypy.engine.block() # cherrypy.config.update({'tools.sessions.on': True, # 'tools.sessions.storage_type': "File",