Re: about the Python code

From: Matt Shomphe <mshomphe_at_comcast_dot_net>
Date: Thu Jul 24 2003 - 14:33:46 CDT

This should be a PC/Web/paper-based system. All three components should
have the same appearance. Both web & pc components should print paper
forms (again, identical in appearance). The printed ballot should fit on
one side of a normal 8 1/2" x 11" piece of paper. The web & pc components
have two general functions: (1) print & (2) larger type. "Larger type"
will result in a multipage ballot (with, I assume, a "Next" function). The
PC version will be implemented in Python. The web version will be
implemented in something -- maybe Python, maybe PHP. Anything I'm missing?

There's a lot of discussion about (what appears to me to be) esoterica:
e.g., codes assigned to the ballots. From the code development point of
view, I'm not seeing this as a huge issue. Whatever implementation is
decided on can (probably) just be plugged-in to the code. From the design
point-of-view, I want to make this as robust and extensible as possible.
Matteo's idea of separating out the "interface data" from the interface
itself will make this a very flexible system. Just tell us what's needed
and we'll try to build it ;-)

FWIW, for generating random numbers, this is what Python's new (2.3)
"random" module says:
General notes on the underlying Mersenne Twister core generator:

* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence
* Without a direct way to compute N steps forward, the
   semantics of jumpahead(n) are weakened to simply jump
   to another distant state and rely on the large period
   to avoid overlapping sequences.
* The random() method is implemented in C, executes in
   a single Python step, and is, therefore, threadsafe.

In other news, this is an article that I thought might be of interest to
the group...


On Thu, 24 Jul 2003 11:51:30 -0700, Alan Dechert <>

> Arthur, Arthur, Arthur,
>> Please humor me. Use 5 digits for ballot number. ....
> I see no case for 5 digits, and every reason to go with 4. There will be
> instances where manual checking that involves the ballot number will be
> involved. You greatly increase overhead with the extra unnecessary
> digit.
> The chance that someone will misread the number is much higher for a 5-
> digit
> number as opposed to a 4-digit number.
> We also want to economize because of the bar code. As I just mentioned
> in
> an earlier message, we want a cheap economical bar code with no more
> characters encoded than absolutely necessary.
> About 500 ballots are normally handled at a precinct on Election Day.
> We'd
> expect to have around 7-8 machines at each. Normally, one machine is
> going
> to handle less than 100 ballots. Each machine would be able to produce
> 1000
> unique numbers with the scheme I've described (i.e., we append the one
> digit
> machine number to a 3 digit random number). If it was close, I would say
> let's error on the side of caution. But it's not close. You have 10,000
> possible ballot numbers for each precinct while you will only use around
> 500
>> You also have to
>> ensure the number given out isn't a duplicate of what's been used for
>> this voting machine in the past day (which Alan mentioned earlier).
> Yeah, this is trivial. You just check the table to see if your number
> has
> already been used and go back and get another if it has.
>> Also use a better random number generator (eventually).
> Right, but not for the demo.
>> States are two letter codes. Counties within California use a 3
>> letter code. Since Texas has about 500 counties, I think we should
>> stick with such a convention.
>> Precinct is a 4 digit code.
>> Perhaps we should add a "ballot type" to the ballot number in case
>> there are multiple ballot types at an election. There are multiple
>> ballot types at a primary election, and we need to handle that.
> I don't see where this has anything to do with ballot number. In the
> larger
> study, we'll have to deal with how to deal with primary elections. Our
> demo
> is for a general election. Let's worry about that later.
>> (We also need a way to ensure that the voter votes only with the
>> correct ballot type. What's our solution to that problem?)
> I think you might be mixing the meaning of "ballot type" and "ballot
> style."
> Doug can probably give us some better terminology here, but "ballot
> style"
> refers to the mix of contests that appears on the ballot according to the
> FYI, the design I've described deals with ballot styles like this: The
> county produces CDs which include a database covering all the contests in
> all the precincts in the county. All the CDs would be exactly the same
> and
> would include all the software for the voting machine. For each
> precinct,
> floppy disks (or some other media) are provided for each PC/voting
> machine.
> The floppy disk would have a parameter file that indicates the precinct
> number and machine number. The voting machine boots up from the CD and
> reads the parameter file on the floppy so the machine provides the
> correct
> ballot style based on the precinct number and sets the correct ballot
> number
> prefix accordingly.
>> Then date in the form YYYYMMDD.
> Depends on how precious our character space is. We may want the date
> shortened.
>> Then a five digit ballot number.
> Four.
>> I think there should then be a ballot sequence number (one
>> digit/character). If someone makes a mistake and prints another
>> ballot, then use the same ballot number with an incremented ballot
>> sequence number. It's a good check that the spoiled ballot won't be
>> used (since it matches in ballot number except for the
>> ballot sequence number on the spoiled ballot is smaller). Does
>> someone who spoils a ballot have to go back to the same PC they
>> originally voted on?
> I see no need for your "ballot sequence number." But again, this is not
> an
> issue for the demo. The voter is instructed to go to a poll worker when
> a
> ballot is spoiled. The poll worker would tear off a corner of the ballot
> (containing the number) and shred the rest of the ballot. The torn off
> number would be put in a box to facilitate reconciliation. It's not
> really
> necessary to have the tear off but it will make it quicker to reconcile.
> The ballot numbers of spoiled ballots are entered into the admin PC so
> that
> when the polls close, they can account for all the ballot numbers used.
> If
> someone doesn't follow procedures such that it doesn't add up, then the
> ballot numbers must be read from each ballot from the ballot box so that
> all
> the extra ballot numbers in the electronic file are excluded that way.
>> Arthur
>> At 9:12 AM -0700 7/24/03, Alan Dechert wrote:
>> >We don't have a specific format worked out but I can give you some
>> >clues. The text should all be in a fixed width (non-proportional)
>> >font that is easy to read for humans and scanners.
>> >
>> >The printout will have a title that goes something like this:
>> >
>> >NOVEMBER 7, 2000
>> >
>> >The ballot number will be printed in each corner. On the bottom, I
>> >think we want the ballot number printed upside down (this is so the
>> >ballot number can be easily read with the ballot face down by
>> >lifting any corner).
>> >
>> >The ballot number will be a random number from a range of 1000
>> >numbers. I don't know how you get a random number in python but
>> >here's what I've done in dBASE.
>> >
>> >MyNumber = "1"+substr(str(rand(),12,3),10,3)
>> >
>> >Incidentally, these four digits will be combined with state,
>> >county, precinct, and date to make a unique key.
>> >
>> >The printout will list the selections made
>> >
>> >
>> >
>> >etc.
>> >
>> >There will be a bar code on the long edge (duplicate on left and
>> >right edge). I will have more to say about the bar code in another
>> >message.
>> >
>> >The print button should be at the end of the on screen ballot image
>> >like I have here.
>> <
>> mockup3.gif>http://home.earthli
>> >
>> >Alan
>> >
>> >
>> >----- Original Message -----
>> >From: <>yu wang
>> >To: <>Matt Shomphe
>> >Cc: <> ;
>> ><>
>> >Sent: Wednesday, July 23, 2003 11:12 PM
>> >Subject: [voting-project] about the Python code
>> >
>> > Hey Matt,
>> > You did ask me a good question. I am not quite sure what kind of
>> >format it suppose look like, I personally do not think we have any
>> >specific format decided yet. However, we do have a picture of a
>> >paper ballot , that is what we like it to be so far, I am not sure
>> >if you have seen it or not, I am sending it to you anyway. In the
>> >mean time, what we really want is to include the printing function
>> >in the Python code. Thank you for the detail questions.
>> >
>> >Adrianne
>> >
>> >
>> >
>> >
>> > Matt Shomphe wrote:
>> >
>> >>Adrianne,
>> >>
>> >>I'd be glad to add another button to the code. However, I'm not
>> >>sure what "Print" should do. Should it just write out a file?
>> >>Should there be a specific format (e.g., XML)? Or should it do
>> >>something else?
>> >>
>> >>Any other suggestions/additions?
>> >>
>> >>I'll try to clean up the code and make it a bit more robust, as
>> >>well as having specific APIs that others can use. I'll try to
>> >>document as best I can :)
>> >>
>> >>Speaking of documentation, is there a specific format that should
>> >>be used? (DocBook, LaTex, plain old text, &c.)
>> >>
>> >>Matt
>> >>
>> >>ps -- Ciao, Matteo! Ho studiato italiano per due anni, ma ho
>> >>dimenticato tutto. E' facile da leggere (perche ho studiato il
>> >>latino per 4 anni), ma e' difficile da parlare :)
>> >>
>> >>On Wed, 23 Jul 2003 16:58:16 -0700, Adrianne Wang
>> >><> wrote:
>> >>
>> >>>Hi Matt,
>> >>>I just ran your code, it is pretty cool. I am wondering if you
>> >>>would like to add one more print button to your code, which
>> >>>provides printing function, then I will add your code to
>> >>> as our first prototype. Thank you.
>> >>>
>> >>>
>> >>>Adrianne
>> >>>
>> >>>
>> >
>> >
>> >
>> >Do you Yahoo!?
>> ><*>Yahoo!
>> >SiteBuilder - Free, easy-to-use web site design software
>> --
>> -------------------------------------------------------------------------
>> -
> -----
>> Arthur M. Keller, Ph.D., 3881 Corina Way, Palo Alto, CA 94303-4507
>> tel +1(650)424-0202, fax +1(650)424-0424
Received on Thu, 24 Jul 2003 12:33:46 -0700

This archive was generated by hypermail 2.1.8 : Wed Aug 06 2003 - 12:50:26 CDT