Git Product home page Git Product logo

whocanivotefor's Introduction

CircleCI Coverage Status Code style: black

WhoCanIVoteFor

This project is designed for people who don't know loads about the ins and outs of elections to use to find out everything about upcoming elections, including candidates, polling stations, electon dates, etc.

It has the following features:

  • "Given a postcode, when is my next election?"
  • "Who are the candidates per election?"
  • "Where is my polling staion?"
  • Enter email address and postcode to get alerted about future elections in your area

It might be good to look at this issue for a little more info.

The reason for building this site:

  1. We have some other tools that are designed for gathering data, for example Democracy Club Candidates and UK Polling Statons. There is value in keeping these sites on their own, as the candidates one in particular has a very different audience to this site.
  2. We want to allow 3rd parties to write sites that we can include in this one via data dumps. 3rd parties shouldn't have to use our codebase in order to make interesting things. We saw this a low during the UK General Election.
  3. This site is very read heavy, so we can think about optimizing for that, rather than both read and write heavy operations. In 2015 this site was a Jekyll install.
  4. We want to be able to spin up new ideas quickly in this codebase, and not pollute the YourNextRepresentative code too much (it has an international focus)

photo 04-03-2016 17 18 46

Results Recorder App

This app will be used by people both at counts and after the count to record results from each election.

There are two types of 'result' that we want to capture:

  1. 'Control' of councils. This is the dominant party or 'No Overall Control' if no party has more than 50% of the council seats. This is a fairly simple data model (AuthorityControlSet), looking something like controlling_party(NULL=True), authority. Stretch goal would be to pre-load the control model with the previous year's control (data to be provided), to allow 'swing' to be calculated ("HOLD", "LAB GAIN", etc).
  2. Votes Cast per person. This is slightly more complex than the above, with roughly the following model:

Results App

In addition to this, we will ask them to record the number of spoilt votes, and the turn out if it's reported.

For both of the above, a non-authenticated user can navigate to an election and area. There they can enter 'control' and 'votes cast' on two different forms.

Both workflow should consoder the following:

  • We want to record more than one result of it's class ('control' and 'votes cast') per election. There are a number of reasons for this:

    1. The result may have been recorded incorrectly, either because of a mistake or out of malice.
    2. The result announced at the count might not be the actual final result ā€“ apparently this happens alarmingly often.
    3. More than one person might report the results.
    4. Someone might want to double check the results as published on the council's web site at a later date (see #2).

    There should be a nice way to see ResultsSet and AuthorityControlSet objects that have differing results recorded, and we should provide some shortcuts, for example to ResultsSet objects where the sum of the CandidateResult votes_cast field isn't the same.

  • Sourcing and timing is important for us, so each model should extend from an abstract base class that has created (datetime), modified (datetime) and source (TextField). Forms should ask for a source (we need to decide if this is required) when recording either type of result.

  • There are different voting systems ā€“ for example Single Transferable Vote, as used in Northern Ireland. This could be out of scope for this initial phase of work ā€“ more research time is needed to see how complex this will be to model.

Dummy ballots and profiles

There is a dummy ballot with dummy candidate profiles, that was produced for The Children's Commissioner for Wales. These are defined in the elections URL file (at time of writing this is "TE1 1ST").

From the resulting dummy ballot page, you can click the candidates to see their dummy profiles. All links on the page are intended to be "dead" links.

Getting started

See INSTALL.md for setup instructions.

Translations

This application can be translated in to different languages.

This is done using Django's standard translation system.

TranslatedTemplateView

There are some templates in the system that are mainly text and that rarely change. For example, the election explainers.

Rather than wrapping this complex document in trans tags, we can translate the entire template as a single file.

To do this, we can use TranslatedTemplateView. This extends Django's TemplateView but attempts to load a template relating to the current language, falling back to the one specified in template_name.

For example if the curent language is cy (Welsh):

TranslatedTemplateView.as_view(template_name="foo.html")

Will try to render foo_cy.html first and if that doesn't exist it will render foo.html

Pre-Election Tasks

Update slack feedback schedule to post more frequently during election season (perhaps daily)and less frequently during non-election season (perhaps weekly). Both the hours and the cron schedule in needs to be edited in sam-template.yaml for this change to take effect.

Mayoral Booklets

PDF booklets can be manually added here wcivf/assets/booklets following the same naming convention as the other booklets. The file name should be the same as the election slug. Then, add the slug and corresponding booklet file name to the list here /wcivf/apps/elections/models.py#L187.

New WCIVF Google Sheets imports (Hustings, local parties)

Peter will have set up some Google sheets in a known format. The CSV version of these sheets are imported in to WCIVF from time to time.

Each election, we create a new set of sheets. These need to be added to the import jobs.

Get the Sheet CSV URL (file -> share -> public to the web -> select sheet / csv > publish > copy URL) For local parties, edit https://github.com/DemocracyClub/WhoCanIVoteFor/blob/master/wcivf/apps/parties/management/commands/import_local_parties.py#L23-L34 For hustings edit https://github.com/DemocracyClub/WhoCanIVoteFor/blob/master/wcivf/apps/hustings/management/commands/import_hustings.py#L60

Commit, PR, merge, deploy.

If you want to show the GB voter ID messaging, set SHOW_GB_ID_MESSAGING = True in settings/base.py

Post-Election Tasks

When we've got some results to show, you'll want to update SHOW_RESULTS_CHART = True in settings/base.py. You'll also need to grab the Flourish chart info and replace it in /templates/home.html. It should live inside the {% if show_results_chart %} block.

Deployments

Deployments are triggered by Circle CI. Take a look at .circleci/config.yml to see details of the deployment workflow.

To increase the number of EC2 instances for an environment (e.g. during busy times around elections) increase the min-size, max-size and desired-capacity variables found in the code_deploy jobs in the config.yml file. For further details, see notes about scaling scaling.

whocanivotefor's People

Contributors

andylolz avatar annapowellsmith avatar bekabyx avatar bobharper1 avatar chris48s avatar danjordan avatar davidmiller avatar davidwilby avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar edjw avatar geowill avatar h2g2bob avatar hugovk avatar issyl0 avatar joemitchell avatar jussiheinonen avatar kateseary avatar malcomio avatar michaeljcollinsuk avatar mrwilson avatar pmk01 avatar symroe avatar tfgg avatar transifex-integration[bot] avatar virginiadooley avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whocanivotefor's Issues

Change 'Elections' box on candidate pages

WCIVF displays candidacy information a bit awkwardly.

image

I think we should just have a heading of Candidacies, then bullet points, e.g.:

Candidacies

  • 2017 Copeland parliamentary by-election (UKIP)
  • 2016 Morton ward, Carlisle local election (UKIP)

Ideally [Copeland] and [Morton ward] would be hyperlinked too.

(This might link with #67 on YNR issues)

Change the font+colour for stories from Mentions

image

I think it might cunningly help differentiate 'external text' from our text. Maybe. We could change the colour too.

(I worry that mentions puts us in too much of a Political space, and so we should include it, but distance it, and font/colour design might help that.)

Postcodes aren't always automatically formatted

Enter a lower-case postcode with no spaces into...
WCIVF frontpage -> formatted postcode passed to whocanivotefor.co.uk/elections/[Post Code] šŸ‘
c.dc frontpage -> unformatted postcode passed to whocanivotefor.co.uk/elections/[postcode] šŸ‘Ž

To avoid situations like below, could that view be amended to display Mapit's output (ie a correctly spaced upper-case postcode) rather than the unformatted input value?

image

Would look better as:
image

Single election display less intuitive than multiple elections version

Single elections are introduced with "Your next election is today" while the intro text for multiple elections is "Your next elections are today (Thursday 5 May 2016)" which helps reduce potential for confusion from the future election/referendum that's also included in the list.

Also, for single elections "one ballot papers" should be "one ballot paper".

image

image

Do something that makes people think they're not alone

Okay, bear with me.

Digital atomises everything innit.

But democracy is about community, movements, people coming together and stuff.

So how do we show that a voter is part of a bigger whole when they're on the site?

If candidates haven't filled in their bios/statements, we could do a "Push this counter if you want to hear from this candidate before the election." ā€” which could count up the clicks ("47 people in your area have said they want to hear from this candidate"), making people feel part of something...

Dunno. Ideas please.

"Print booklet or poster" option

An option on a postcode-results page to print out the information.

(Clever stuff puts information into a sensible PDF or something)

Add social sharing buttons to WCIVF

If people find our site useful, hopefully they'll want to share it with their friends and family.

I think this should live at the bottom of the page. Perhaps alongside the "Would you recommend this?" thing Sym has previously talked about.

The Guardian example:
leaked_ttip_documents_cast_doubt_on_eu-us_trade_deal___business___the_guardian

Priority = Facebook, Email, Twitter, LinkedIn, ... whatever.

(p.s. AdBlockPlus blocks those icons on the Guardian. Interesting!)

Questions from Porism

We have four questions if you don't mind. Tell me if I should put these elsewhere or split them up:

  1. Is there a source of current councillors? Can we identify which cease to be valid after 5 May unless re-elected? Can we identify ones that have stood down since election?
  2. When will the results API be available and what is format of calls? How do we test?
  3. When will the result RSS be available and what is format of calls? How do we test? Can we have different feeds or a filter for validated or not? Can we have a filter for "updated since date/time"?
  4. How do we provide results on the night? I've registered with OutForTheCount. Do I just wait to be contacted?

Thanks
Mike

Mention the possibility of other smaller elections.

Lots of people will have parish/town/community elections on 4 May too.

Can we add a statement somewhere that just gives people a heads-up about these? Or, given we can't tell them any more about their elections, is it a bit pointless?

Display elections in a predefined order

It seems natural to group elections together by the position the elected candidate will hold (e.g. London Assembly elections should be grouped. @davidmiller made this point on slack).

Additionally: the constituency elections are more familiar than list elections (voting for a person vs a party) so Iā€™d suggest that for each group, the constituency election should be shown first.

Sometimes elections are in the future

https://whocanivotefor.co.uk/person/4754/george-galloway

George Galloway has stood in the following elections:

Assembly Member: 2016 London Assembly Election (Additional)
Mayor of London: London Mayoral Election
Member of Parliament for Poplar and Limehouse: 2015 General Election
Member of Parliament for Bradford West: 2015 General Election

Shurely:

George Galloway is a candidate in the following upcoming elections:

Assembly Member: 2016 London Assembly Election (Additional)
Mayor of London: London Mayoral Election

George Galloway has stood in the following elections:

Member of Parliament for Poplar and Limehouse: 2015 General Election
Member of Parliament for Bradford West: 2015 General Election

Store datetime and source for every result

I suggest subclassing django_extensions TimeStampedModel for this, adding a source TextField.

This base class should be used for every type of result input from users.

Problems opening external links?

Feedback from F:

One thing that niggles however is that the links donā€™t open when I click them, I have to right click and say open in a new tab. Is that just me or a specific functionality?

Oh dear! Iā€™m using Safari 9.0.3 and itā€™s just the links to the candidatesā€™ external sites. Links internally seem to work fine.

Election names/headings are unclear

image

The title

"2016 London Assembly Election (Constituencies)"

doesn't even mention my constituency (which isn't on the page anywhere!). It should say something clearer, like

"Enfield and Haringey
London Assembly Election 2016"

or similar/better :)

LGiU user group

This is a login role that will give LGiU staff to do particular things. on the site.

User account can be created by a user with staff status, and login can be very basic (this is a one off set of users, who need to be authrnticated for a couple of weeks at most).

Update to account for wheredoivote api changes

When we deploy the recent updates to the wheredoivote API, we will need to update the code in

class PollingStationInfoMixin(object):

and
https://github.com/DemocracyClub/WhoCanIVoteFor/blob/8c32f80e813ad744daec1e9c4487415f465d2ab8/wcivf/apps/elections/templates/elections/includes/_polling_place.html

to account for these changes.

I think the things we will need to account for are:

  • API root location has changed (breaking change)
  • Points are now represented as GeoJson features, not the previous bespoke format (breaking change)
  • We can now find polling stations by address where postcodes cross polling districts (enhancement, non-breaking)

Decide how to display candidate bios / statements.

I checked the YNR repository, but couldn't spot the right issue for this. Related trello card here: https://trello.com/c/P4qJOx5h/973-add-biographies-profiles-statements-to-ynr

We've known for a while we want to offer candidates a space to write 'in their own words' or whatever.

I think this could be "Biography" (about you, the candidate; 100 words) and "Statement" (why do you want to be elected? what will you do? 100 words). Or it could be one box of 200 words.

This is 200 words:

Malesuada laoreet primis. A tempus ullamcorper quisque pharetra Turpis feugiat condimentum facilisis aliquam fringilla fames cum accumsan egestas cursus dapibus cras ipsum amet torquent nisl maecenas, cum laoreet pharetra. Libero vel facilisi molestie commodo lobortis nostra malesuada Dis netus blandit senectus semper blandit nec nec erat.

Placerat curae; arcu rutrum platea ultrices. Bibendum blandit imperdiet nec conubia Nibh mollis rhoncus pede sed auctor erat posuere ut. Fames sociis ullamcorper conubia aliquet gravida ligula dui morbi rhoncus. Ridiculus in mattis facilisis, iaculis placerat rutrum quam sem. Lorem. Morbi risus pulvinar est. Semper phasellus pede malesuada auctor dolor cum accumsan Nec lacus sit sociis mus proin netus nec a nascetur turpis. Etiam sed. Ad imperdiet nostra eleifend nulla integer elementum suscipit. Nec eu ante convallis eget. Turpis felis, proin lectus auctor sit erat nascetur fermentum. Aenean habitasse cursus eu sapien. Condimentum. Senectus, nullam vestibulum malesuada.

Ultrices quisque elementum pulvinar, quis mauris penatibus integer dis ullamcorper laoreet metus eros lorem vel orci gravida est nam laoreet sapien risus metus taciti, gravida at proin accumsan, est mattis netus ut penatibus ut sociosqu dolor duis, proin. Nascetur libero dictum. Lobortis mattis vestibulum lectus rutrum blandit egestas. Natoque a. Enim Justo, eleifend platea. Fringilla scelerisque Hac.

Store list of organisations that have elections

This should use candidates.democracyclub.org.uk from as the canonical source of organisations and posts, and import from the API into a simple format that works for this use case.

The importer should be idempotent.

This list of organisations or authorities will be used to store results against.

"organisations" can be any body that has an election, including local authorities and regional governments. The type of organisation should be stored on the model.

No next action at bottom of constituency page

Observing over someone's shoulder, they entered their postcode fine and scrolled down the list of elections.

Once they got to the bottom they seemed a bit lost, so maybe there needs to be a CTA there, such as sharing it by email/social media.

Reorder information on candidate pages

A wise man once said:

so, in terms of ā€œLearning more about this candidateā€, I think an email address is the least useful thing. A wikipedia link, a website address, a twitter account are all more useful.

Agreed. One would then email one's candidate if the information above wasn't enough.

Skeleton view structure

Let's not worry too much about layout and design for the time being.

The initial views within the app should be something like:

/

  • Before the data starts coming in:
    1. Explanation text and call to action to record results (embedded google form)
  • When results start coming in / on the night:
    1. Call to find results for an authority.
    2. List of authorities without any result recorded ordered by approximate count time (see #4)
    3. List of authorities with control recorded at least once
    4. List of authorities with at least one 'votes cast' result recorded.

/authority/[pk]

  1. Expected count times
  2. Button to record control (link to form page)
  3. Button to record votes cast (link to form page) ā€“Ā hold off on this for this milestone
  4. (Admin only): Mark an authority as having results (set a flag, even if we don't know what the results are ā€“ this flag is set to true if any(ResultsSet, ResultsSet))
  5. Anything we know (results recorded for this authority)

/tasks/

  1. List of authorities ordered by results_in=True at the top, with a very obvious call to action like: "go to this authority's website and try to figure something out about this election". Normally the twitter account will be a good source ā€“Ā the page should explain this.
    This is the page that our most keen helpers will sit on and use to know what to do next.

City of London: no wards?

Do we have the ward-level geographies for the City of London? (They're probably not called wards in the City, but battels or fiefdoms or something... but you know what I mean.

At the moment, it's just dumping me in the overall election...

image

Store approximate count start times.

This should be a model with an FK to Election and Organization and should contain the rough time that we expect the count to start.

Start times will be rough, but for example, we know that some authorities with more than one count won't start a particular count for a day or two after the polls close, e.g, they will count Mayor first, then local elections, then PCC.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.