Re: [PyMNtos] Digest for pymntos@googlegroups.com - 4 Messages in 2 Topics

4 views
Skip to first unread message

William Cannon

unread,
Nov 17, 2013, 9:46:16 PM11/17/13
to pym...@googlegroups.com
Challenge (albeit a bit late) Accepted!

I wrote up a ranked choice voting calculator in python today.

Programs:

election.py 
provides:   ranked-choice voting
input:  csv file containing all votes for an election (1 vote per line, a line consists of 1+ choices for a candidate)
output:  run it and see
e.g.  election.py  election_csv_file.csv

election_votes_generator.py
provides:   a simple way to create a csv of ranked-choice votes
input:  arguments  (OUTPUT_FILE VOTERS CANDIDATES ALLOWED_CHOICES)
e.g.  election_votes_generator.py out.csv  200000  15  3
This would create a simulated set of votes containing 200000 votes, with 15 candidates, where a vote is for 3 candidates in ranked order.

fyi:  I ran a simulated election with 1000000 votes, 30 candidates, and 3 choices allowed per vote.

Time to run… 1 minute 31 seconds.

If this is interesting to anyone, please use it and contribute back. 

Warm regards,
William Cannon



On Tue, Nov 12, 2013 at 8:49 PM, <pym...@googlegroups.com> wrote:

Group: http://groups.google.com/group/pymntos/topics

    "Peter J. Farrell" <p...@maestropublishing.com> Nov 11 11:39PM -0600  

    Wow, all great ideas for the web dev group meeting in December. For
    those of you that didn't stick around at the end, we kicked around some
    other ideas.
     
    One idea was to build a simple library application for our new PyMNtos
    library. I really like this idea because its something good for the
    group, a great learning experience and the knowledge domain is small but
    approachable (everybody knows the basics of a library system so no
    special domain knowledge is needed).
     
    Simple:
     
    * Borrowers
    * Catalog
    * Checkout History / Status
     
    More advanced / future ideas:
     
    * Integrate with Meetup API to let any group member be an automatic
    borrower therefore not needing yet another account. Meetup.com actually
    maintains an official Python API library
    (https://github.com/meetup/python-api-client)
    * Email reminders maybe through a place like SendGrid (they have a 200
    free emails per day plan)
    * Hosting on Heroku
     
    For technologies / libraries, I'd like to suggest the following -- some
    for simplicity and convenience:
     
    * Django (along with the normal South, Pip, etc.)
    * Meetup.com API
    * Bootstrap for a CSS framework / design (they way we don't have to
    focus on an unique design, which isn't the point in something like this)
    * Hosting on Heroku (free for one dyno) with a developers Postgres DB,
    SendGrid for email SMTP service, which we would have such low usage that
    we could easily use the free plans for all of these things
     
    If we built this over a few meeting and do at home hacking as a group,
    we could then use the design and we could swap out Django and port to a
    micro-framework like Flask. I believe this is a better route than Flask
    first. Django will allow us to gloss over some items -- let them be
    magical -- and keep the concepts as simple as possible. This way we can
    focus on architecture / design and not worry about things like SQL
    (ORM), advanced CSS (covered by bootstrap), hosting (Heroku is dead simple).
     
    For example, those that don't do much SQL -- having to write queries and
    manage everything else can be hard all at once. After we get some stuff
    under people's belts, it would nice to use Flask and SQLAlchemy so
    people can appreciate what an ORM does and what it doesn't.
     
    Another round after Flask is to port things over to Google App Engine.
    SQL would be replaced with BigTable, etc.
     
    For December I'd be willing to get a Git repo setup on GitHub (open an
    official PyMNtos group) and get people on that. At the meeting we can
    map out our domain (I have a nice big portable whiteboard for
    prototyping) and get organized. I'd also like people to volunteer to
    blog what we did at the meetings. Maybe very interested people would
    like to volunteer to be project manager, UI consultant, etc.
     
    What do people think? Let's keep talking here. I'd like to have a good
    plan in order by our main meeting Thursday so we can announce it.
     
    .pjf
     
     
     
    Derek Anderson said the following on 11/08/2013 08:10 AM:
     
    --
    Peter J. Farrell
    Principal Technologist - Maestro Publishing, LLC
    http://blog.maestropublishing.com
    Identi.ca / Twitter: @maestrofjp
     
    * Learn about VSRE. I prioritize emails with VSRE in the subject! http://vsre.info/
    * Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/

     

    David Fawcett <david....@gmail.com> Nov 12 08:29PM -0600  

    As the person who piped up and suggested a more concrete meeting, I thought
    that I should speak up...
     
    I think that this is a great approach! +1 on all of Peter's suggestions
    above. I also like the fact that instead of building the front end to the
    'my record collection' Hello World database application, we will be
    building an app that we need.
     
    For those of you who are pretty new to Django (like me), I suggest working
    through the official 'Writing your first Django app' tutorial at
    https://docs.djangoproject.com/en/1.6/intro/tutorial01/ I did most of it
    yesterday and it is a great introduction to Django and the Django flavor of
    MVC.
     
    I like the addition of hosting on Heroku and putting the repo on Github.
    That will add some good practical skills to help people get their own 'My
    First Django' project out on the World Wide Web.
     
    David.
     
     
     
     
    On Mon, Nov 11, 2013 at 11:39 PM, Peter J. Farrell <

     

    "Peter J. Farrell" <p...@maestropublishing.com> Nov 11 09:05PM -0600  

    Jim Cummins said the following on 11/11/2013 04:42 PM:
     
    > Anyhow I am looking at this CSV file and was wondering if this was the
    > same data you all are looking at?
     
    > http://vote.minneapolismn.gov/www/groups/public/@clerk/documents/webcontent/2013-mayor-final-rvc.xlsx
    Nah, this is just details the each round of vote for the RCV. We
    actually need the original ballot information --- so if 1st choice
    Candidate X is eliminated, we need to know what that particular person's
    2nd choice is. Right now the data posted is in aggregate...
     
    An example might be -- each line is a "ballot" with up to three choices:
     
    Joe,Jane,Gordon
    Jane,Gordon,Randy
    Jane
    Gordon,Randy
    Joe,Randy
     
    --
    Peter J. Farrell
    Principal Technologist - Maestro Publishing, LLC
    http://blog.maestropublishing.com
    Identi.ca / Twitter: @maestrofjp
     
    * Learn about VSRE. I prioritize emails with VSRE in the subject! http://vsre.info/
    * Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument instead! http://fsf.org/campaigns/opendocument/

     

    Bill Bushey <wbu...@gmail.com> Nov 12 09:33AM -0800  

    Hi Everybody,
     
    Sorry I've been silent all this time since posting the challenge. Friday,
    Saturday, and Sunday I was busy preparing for and helping to run the
    CityCampMN <http://citycampmn.org> unconference and hackathon. Yesterday I
    finally slept :p
     
    I was definitely unclear about one bit of this challenge. We are not asking
    for folks to count the actual Minneapolis Mayoral election. Instead, the
    challenge is focused on implementing the process of Ranked Choice Voting in
    Python. Because data on actual ballots are not yet available, you do not
    have to worry about matching a spec regarding ballots. All we are asking
    for is a simple Python script that *could* (with some modification) decide
    a RCV election, once ballot data becomes available.
     
    I'm awake and not running an event, so I'm available to answer questions.
     
    Cheers,
    Bill
     
    On Monday, November 11, 2013 9:05:32 PM UTC-6, Peter J. Farrell wrote:

     

--
Meetings Schedule / RVSP on our Meetup at http://python.mn
---
You received this message because you are subscribed to the Google Groups "PyMNtos" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymntos+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Peter Farrell

unread,
Nov 18, 2013, 7:35:45 PM11/18/13
to pym...@googlegroups.com
Bill, this looks really cool.  I checked out the source for it and it isn't that complicated at all.


A couple of questions:

1) Is that the real .csv ballot information from the 2013 MPLS Mayor's race?

2) If yes, did you're output match the number of rounds and results from the race?

3) Would you like to present this at PyMNtos meeting sometime in the future?
Reply all
Reply to author
Forward
0 new messages