Coder Social home page Coder Social logo

bradbeattie / api.iscanadafair.ca Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 1.0 17.42 MB

A relational database and accompanying API of Canadian parliamentary data

Home Page: https://api.iscanadafair.ca

Python 10.83% Jupyter Notebook 78.47% Shell 0.16% HTML 0.17% CSS 7.16% JavaScript 3.21%
canada election-data elections federal-government parliament parliamentary-data parliamentary-elections parliamentary-monitoring parliaments

api.iscanadafair.ca's People

Contributors

bradbeattie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

api.iscanadafair.ca's Issues

Searching JSON unicode characters

I can't currently search like names__contains=prévoyant, but instead have to search like names__contains=pr\u00e9voyant. Should be possible to JSON-encode contains, startswith, and endswith queries. Regex queries not so much, I predict.

Refactor data into separate apps

  • One for shared parliamentary data: parliament, session, ridings, parties
  • One for elections: general elections, candidates, election ridings
  • One for parliamentary proceedings: sittings, meetings, votes, bills

Ballots (Valid) incorrectly aggregated to election level

I think this one has to do with some ridings having multiple candidates in older elections. If we're naively summing up ballots per candidate as our total valid ballots sum, those ballots will be erroneously considered multiple times.

Reintroduce HoC votes

It seems the new XML format is missing the vote number. For example, http://www.ourcommons.ca/Parliamentarians/en/HouseVotes/ExportVotes?output=XML has its last entry as the following.

<VoteParticipant><ParliamentNumber>42</ParliamentNumber><SessionNumber>1</SessionNumber><DecisionEventDateTime>2017-05-15T00:00:00</DecisionEventDateTime><DecisionResultName>Agreed To</DecisionResultName><DecisionDivisionNumber>275</DecisionDivisionNumber><DecisionDivisionSubject>Motion respecting Senate amendments to Bill C-37, An Act to amend the Controlled Drugs and Substances Act and to make related amendments to other Acts</DecisionDivisionSubject><DecisionDivisionNumberOfYeas>173</DecisionDivisionNumberOfYeas><DecisionDivisionNumberOfNays>112</DecisionDivisionNumberOfNays><DecisionDivisionNumberOfPaired>0</DecisionDivisionNumberOfPaired><BillNumberCode>C-37</BillNumberCode><Yea>0</Yea><Nay>0</Nay><Paired>0</Paired></VoteParticipant>

Note that it's the 274th entry in the list, despite being named Vote No. 275 (http://www.ourcommons.ca/Parliamentarians/en/votes).

The old version had the vote number. I've contacted [email protected] to see about fixing this. After it's fixed, I'll reintroduce the data.

Daily cron to keep data up to date

At the moment, it's built with a "fetch once and never come back" approach. Fortunately, the fetch_url commands should respect the appropriate index vs detail refetches. But we shouldn't have to go back through more than the last two parliaments for each data source, keeping performance acceptable.

Filtering named tuples

Some fields (e.g. chamber) are positivesmallintergerfields. But when we serialise them, we're showing the verbose display instead of the int. So shouldn't we be able to filter by those display names?

LoP unlinked candidates hard to match up

Very likely the same person:

IACONO, Angelo
	 General Election 42 (2015-10-19), Quebec: ALFRED-PELLAN, IACONO, Angelo
IACONO, Angelo G.
	 General Election 41 (2011-05-02), Quebec: ALFRED-PELLAN, IACONO, Angelo G.

HALICKI, Stephen
	 General Election 38 (2004-06-28), Ontario: YORK SOUTH--WESTON, HALICKI, Stephen
HALICKI, Steve
	 General Election 39 (2006-01-23), Ontario: YORK SOUTH--WESTON, HALICKI, Steve

Same last name, timeframes that match up, but significantly different first names:

HOLTON, Edward
	 By-Election of 1880-04-17, Quebec: CHÂTEAUGUAY, HOLTON, Edward
	 General Election 5 (1882-06-20), Quebec: CHÂTEAUGUAY, HOLTON, Edward
	 General Election 6 (1887-02-22), Quebec: CHÂTEAUGUAY, HOLTON, Edward
HOLTON, Hon. Luther Hamilton
	 General Election 1 (1867-09-20), Quebec: CHÂTEAUGUAY, HOLTON, Hon. Luther Hamilton
	 General Election 2 (1872-10-12), Quebec: CHÂTEAUGUAY, HOLTON, Hon. Luther Hamilton
	 General Election 3 (1874-01-22), Quebec: CHÂTEAUGUAY, HOLTON, Hon. Luther Hamilton
	 General Election 4 (1878-09-17), Quebec: CHÂTEAUGUAY, HOLTON, Hon. Luther Hamilton

GODIN, Jason
	 General Election 42 (2015-10-19), New Brunswick: ACADIE--BATHURST, GODIN, Jason
GODIN, Yvon
	 General Election 36 (1997-06-02), New Brunswick: ACADIE--BATHURST, GODIN, Yvon
	 General Election 37 (2000-11-27), New Brunswick: ACADIE--BATHURST, GODIN, Yvon
	 General Election 38 (2004-06-28), New Brunswick: ACADIE--BATHURST, GODIN, Yvon
	 General Election 39 (2006-01-23), New Brunswick: ACADIE--BATHURST, GODIN, Yvon
	 General Election 40 (2008-10-14), New Brunswick: ACADIE--BATHURST, GODIN, Yvon
	 General Election 41 (2011-05-02), New Brunswick: ACADIE--BATHURST, GODIN, Yvon

GILLMOR,
	 General Election 2 (1872-10-12), New Brunswick: CHARLOTTE, GILLMOR,
	 General Election 3 (1874-01-22), New Brunswick: CHARLOTTE, GILLMOR,
	 General Election 4 (1878-09-17), New Brunswick: CHARLOTTE, GILLMOR,
	 General Election 5 (1882-06-20), New Brunswick: CHARLOTTE, GILLMOR,
	 General Election 6 (1887-02-22), New Brunswick: CHARLOTTE, GILLMOR,
	 General Election 7 (1891-03-05), New Brunswick: CHARLOTTE, GILLMOR,
	 General Election 8 (1896-06-23), New Brunswick: CHARLOTTE, GILLMOR,
GILLMOR, Daniel
	 General Election 10 (1904-11-03), New Brunswick: CHARLOTTE, GILLMOR, Daniel

So what can realistically be done about this? Unsolved, we have a lot of fragmented person records. But I'd rather not go through each and every one and try to make a judgement call. It's just that without defragging these records, we can't do proper analysis of when candidates come and go.

Français?

C'est totalement en anglais actuellement.

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.