Giter Site home page Giter Site logo

mysociety / theyworkforyou Goto Github PK

View Code? Open in Web Editor NEW
219.0 28.0 53.0 329.61 MB

Keeping tabs on the UK's parliaments and assemblies

Home Page: http://www.theyworkforyou.com/

License: Other

Ruby 0.21% Shell 0.55% PHP 67.35% CSS 0.83% Python 1.70% HTML 10.58% JavaScript 1.00% Perl 9.22% Hack 2.03% SCSS 6.49% Dockerfile 0.05%
civic-tech transparency parliamentary-monitoring politics politicians uk parliament civictech mysociety democracy

theyworkforyou's Introduction

TheyWorkForYou

Hello everyone,

This is the source code that powers the TheyWorkForYou.com website. It's mainly written in PHP, although there are also some Perl scripts for database loading and indexing. The backend parser code is separate and available on GitHub. You can read more about this on TheyWorkForYou's parser info page

The TheyWorkForYou source code in this distribution is released under a BSD style license. Roughly, this means you are free to copy, use, modify and redistribute the code or binaries made from the code. Commercial or non- commercial use is allowed. However, we disclaim warranty, and expect you not to use our name without our permission. See the file LICENSE.md for exact legal information.

What is TheyWorkForYou anyway?

Everything MPs say in the UK's House of Commons is recorded in a document called Hansard; TheyWorkForYou helps make sense of this vital democratic resource. It also includes things from the House of Lords, the Scottish Parliament, and the Northern Ireland Assembly.

How on earth do I use this code?

See INSTALL.md for installation questions.

If you have questions, the best place to ask is the mySociety TheyWorkForYou email list at https://groups.google.com/a/mysociety.org/forum/#!forum/theyworkforyou

Developing with Docker

You will need a recent version of Docker.

Running docker compose up [ -d ] will start the environment. The first time you run this it may take a few minutes as various images are downloaded and the application image built locally.

Once it's done, you should be able to view the front page at http://localhost:8000. However the default build contains no data, so take a look at INSTALL.md for information about downloading and importing Parlparse data (members, debates, votes, etc).

You can stop the environment by running docker compose down. Adding a -v will remove any Docker volumes that may be in use, including all their data.

DOCKER.md has some more detailed notes on the development environment, together with some useful commands and more detailed Docker-specific setup notes.

To use xdebug in VS Code while using WSL, you'll need to set an environmental variable of the WSL_IP within the subsystem of the IP address of the subsystem.

Developing with codespaces

Open in GitHub Codespaces

Start a new codespace on Github by selecting the Code dropdown (top right), and starting a new codespace (or use the GitHub CLI).

You can also use the badge above to use a prebuild with a basic amount of data.

This will setup the Docker container and environment. Once finished, the link to the site should be avaliable in the ports tab of the terminal panel.

To populate with a minimal amount of data, run scripts/quick-populate (about 1 hour).

DEPRECATED: Developing with Vagrant

Please note that we are not currently supporting the Vagrant environment, and may remove it altogether. Please use the Docker environment instead.

You will need the latest versions of VirtualBox and Vagrant, then:

  • Run vagrant up.
  • Go make a cup of tea. It may take a while whilst Vagrant and Puppet do their thing.
  • Point your web browser at http://10.11.12.13 and marvel at modern technology.

See INSTALL.md for instructions on downloading and importing Parlparse data (members, debates, votes, etc).

Compiling Static Assets

If you're working on a page which uses the redesign, you will need to compile static assets after changes:

  • vagrant ssh
  • cd /vagrant/theyworkforyou/www/docs/style
  • bundle exec compass compile for a one-off compilation or bundle exec compass watch to recompile on changes

Testing

TheyWorkForYou includes a test suite, using PHPunit. To run tests, ensure that the environment variables TWFY_TEST_DB_HOST, TWFY_TEST_DB_NAME, TWFY_TEST_DB_USER and TWFY_TEST_DB_PASS are set and contain relevant information for your testing database. The database will be stripped down and rebuilt during testing, so make sure it's not an important copy.

You may find that in some versions of PHPUnit errors are thrown regarding code coverage reports. If this is the case, the version installed by Composer and located at /vendor/bin/phpunit should run correctly.

Build Status

Code Coverage

Scrutinizer Quality Score

mySociety Installability

Acknowledgements

Thanks to Browserstack who let us use their web-based cross-browser testing tools for this project.

theyworkforyou's People

Contributors

ajparsons avatar andylolz avatar annapowellsmith avatar antonionoca avatar chloecollins avatar colmdoyle avatar crowbot avatar dracos avatar droom avatar edwardwall avatar handelaar avatar henare avatar jacksonj04 avatar lucascumsille avatar mhl avatar myfanwynixon avatar mysocietyclive avatar paurakhsharma avatar rbibby avatar robinhouston avatar sagepe avatar samsmith avatar sebbacon avatar struan avatar stuartlangridge avatar wrightmartin avatar zarino 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

theyworkforyou's Issues

Twitter bot that tweets @ mps when their inboxes fill up

Twitter bot that tweets @ mps when their inboxes fill up

We already know who’s inboxes are full, data we require in order to successfully deliver mail. Tweeting @ MPs who’s mail is bouncing would be both useful in terms of telling them to clear their mail, as well as mildly amusing for everyone else.

Add Select Committees in basic form

Add transcripts of all select committees, add them into alerts. Do not have pages for non-MPs, but give them IDs that can join together multiple appearances.

Photo attributions

If the site allowed a photo to carry an attribution string, we could use a wider variety of photos (e.g. plenty from Wikipedia).

MP "trackbacks" - intra-Hansard citations

Suggestion: if a TWFY annotation contains a link to another speech in TWFY, then a link to the annotated speech should automatically appear on the page of the linked speech. Similar to the blogging concept of a trackback.
Example:

¤Lord Razzall citing Vincent Cable
¤Vincent Cable alluding to Winston Churchill
also:

I've noticed a few times MPs asking for written answers, and then making reference to the information in a debate. Not a great example, but:

¤a question from David Davies regarding how much is being spent of videogames in young offender institutions
¤and then in a debate

TWFY doesn't cope with two lords with the same name

Lord Aberdare, 4th of that Barony, is present in TheyWorkForYou. He died in 2005, and his son, the 5th Baron Aberdare, was by-elected to the House of Lords recently. /peer/lord_aberdare only gives you the 5th Baron, with no way of viewing the 4th any more.

Spot oversea territory postcodes

As with WriteToThem (fyr/web/index.php has the lookups), we should spot special postcodes such as the Falkland Islands and alert accordingly, rather than just give an error.

Attribution string for photos

If we had a way of attributing photos, we could put Wikipedia photos up of MPs and so on, currently as there's no way of doing that we can't.

Deal with the "multiple alert"s

There are some email alerts that are obviously meant to be more than one alert, with separate search terms separated by commas. We should:

  • alter these to be separate alerts,
  • email everyone to apologise for our not-clear-enough text/point out searches for their terms,
  • set it up so multiple alerts can be specified at once in the alert sign-up.

Heading improvements

The "FOO is in the Chair" statements on Westminster Hall debates are appearing as headings on TheyWorkForYou, which is a bit confusing and can split a debate in two if there's a change of chair halfway through. They should be spotted when the HTML is being parsed and altered to normal stage direction paragraphs. The parser is a separate project, code available here: ¤http://www.knowledgeforge.net/project/ukparse/

Also, the parser has trouble spotting when things are subheadings or full headings. This has been looked at before, but could perhaps be done better nowadays.

Add the Welsh Assembly

We can show debates and send email alerts for Westminster, Scotland and Northern Ireland, but not Wales. It is an elitist discrepancy, and we should import the required data and provide the usual functionality of search, browse, pages per debate and per speech, and email alerts. This does not cover vote analysis or import.

Future business

Add the ability to see as much of the forward-looking calendar of debates, votes, committees and events as Parliament has published at any point in time. Provide the ability to browse it, search it, and (most important) set up alerts to warn people of upcoming events that may interest them.

TheyWorkForYou: Petition Your MP

MPs have long complained about not being able to handle spammy constituency mail that consists of thousands of copies of the same thing.

We could build a petitioning system into TheyWorkForYou that would allow people to make petitions aimed at specific MPs. MPs and campaigns could then point people to these, reducing the spammy mail and making it much easier to see what the public is trying to get out of MPs.

Essential features would include:
a) Alerting MPs to petitions and sending them updates as signatures grow
b) Allow MP and petition creator to send limited number of messages to signers
c) Integrate with pre-existing rate-limiting on WriteToThem, to encourage people to turn their bulk mails into petitions.

Get rid of video for "so-and-so: rose---" speeches

There's no point having video for speeches that are just "So-and-so: rose---" because 90% of the time it happens off camera so all you can watch is the current speaker looking in a slightly different direction.

Often, the same applies for speeches that are just "Would so-and-so give way?" but that might be slightly more difficult to code as "so-and-so" could be "the Minister", "the honourable Lady", "my hon. Friend" etc.

Add MP's Positions on national issues obtained via DemocracyClub

As part of the Democracy Club process we asked for candidates positions on a range of major issues (i.e http://election.theyworkforyou.com/quiz/S80BF ) . Many of them became MPs, so we have structured data for many of their answers.

We could make MP pages more useful simply by adding these as a list of statements, such as:

"Disagrees with the statement 'Even if Iran develops a nuclear weapon, Britain should not support any military action against Iran'"

We don't have this data for all MPs, but we could allow those who didn't do the survey at the time of the election to do it now.

Later on it might become possible to compare statements against voting behaviour, but that would not be within the scope of this phase of work.

Add future business to TWFY

Parse & incorporate future business into TWFY
Build UI for reading it

Build alerting mechanisms

Thought (not for this ticket) - could we perhaps build an alerting system for 'important' votes of different sorts, so people could subscribe to say 'email me when my MP is going to vote on an important environmental/medical/tax issues'? Would have to do it in conjunction with a media partner to do all the research of course (or have the most amazingly dedicated volunteer).

Improve internal linking and browsability through crowd-sourcing missing data

There are two main examples of weaknesses in our data that could be improved by crowdsourcing certain gaps in our data:

Improve stats generation

For example, not sure it's running on MLAs, or former MPs, for the ones that it would be fine to run (e.g. comments_on_speeches)

Use data.parliament.uk data

e.g. http://data.parliament.uk/resources/Members/api/Members.svc/help
Note (August 2013), there's a new API at http://data.parliament.uk/membersdataplatform/memberquery.aspx which looks to have more.

From this we could get the following:

  • Commons membership and biography details
  • Lords membership and details, and recently new or left members
  • Departments, their minsters and opposition posts
  • Committees and their membership (both houses)
  • Lords register of interests

A way of fetching/storing/keeping this data up to date (perhaps within the parser where it historically has been), needs to be written. This could also alert us to changes in composition, party changes, and so on.

TWFY PBC attendance numbers should be per person

Currently, Anne Main is listed as attending 0 out of 18 sessions of the Planning Bill PBC, as it had 18 sessions in total. According to the source debates on parliament.uk, she was only a member for the first two sessions, so should more accurately be listed as 0 out of 2.

Better maiden speech links

Currently the code looks for the first contribution in the database per MP that contains any of a set of phrases (e.g. 'maiden speech', 'predecessor'). This should be fine for the current intake, but I assume there are some mistakes in the past. data.parliament.uk does include maiden speech data, in the form of date and column number, which may well be enough to match even better (we have column number data).

Peter Robinson is broken

It gets stuck in an infinite redirect, presumably some MP/MLA confusion as to what URL it should be on.

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.