{"id":15735714,"url":"https://github.com/simonrw/uk-election-results-analysis","last_synced_at":"2025-03-31T04:14:56.053Z","repository":{"id":53475557,"uuid":"139349908","full_name":"simonrw/uk-election-results-analysis","owner":"simonrw","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-29T17:53:19.000Z","size":21,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T08:45:16.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonrw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-01T17:56:54.000Z","updated_at":"2018-07-03T21:08:26.000Z","dependencies_parsed_at":"2022-08-18T20:10:29.984Z","dependency_job_id":null,"html_url":"https://github.com/simonrw/uk-election-results-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrw%2Fuk-election-results-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrw%2Fuk-election-results-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrw%2Fuk-election-results-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonrw%2Fuk-election-results-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonrw","download_url":"https://codeload.github.com/simonrw/uk-election-results-analysis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413237,"owners_count":20773053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T01:14:47.311Z","updated_at":"2025-03-31T04:14:56.029Z","avatar_url":"https://github.com/simonrw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Election results\n\n## REST API query design\n\nFirst, send a request to\n`http://lda.data.parliament.uk/electionresults.json` which is the top\nlevel endpoint.\n\n\n```\n# Root request, returns election result meta-objects\nelections = FETCH http://lda.data.parliament.uk/electionresults.json |\u003e result |\u003e\ntotalResults\n\nfor election in elections:\n    # Extract constituency info\n    {\n        constituency_url = election |\u003e constituency |\u003e _about\n        constituency_info = FETCH constituency_url\n\n        constituency_type = constituency_info |\u003e result |\u003e primaryTopic |\u003e constituencyType\n        constituency_name = constituency_info |\u003e result |\u003e primaryTopic |\u003e label |\u003e _value\n        constituency_os_name = constituency_info |\u003e result |\u003e primaryTopic |\u003e osName\n    }\n\n    # Extract election info\n    {\n        election_url = election |\u003e _about\n        election_info = FETCH election_url\n\n        election_type = election_info |\u003e result |\u003e primaryTopic |\u003e electionType\n        election_label = election_info |\u003e result |\u003e primaryTopic |\u003e label |\u003e _value\n        candidates = election_info |\u003e result |\u003e primaryTopic |\u003e candidate\n        turnout = election_info |\u003e result |\u003e primaryTopic |\u003e turnout\n\n        for candidate_url in candidates:\n            candidate = FETCH candidate_url\n            vote_change_percentage = candidate |\u003e result |\u003e primaryTopic |\u003e voteChangePercentage\n            votes = candidate |\u003e result |\u003e primaryTopic |\u003e numberOfVotes\n            full_name = candidate |\u003e result |\u003e primaryTopic |\u003e fullName |\u003e _value\n            party = candidate |\u003e result |\u003e primaryTopic |\u003e party |\u003e _value\n    }\n```\n\n## Models\n\n```\ncandidate:\n    id integer primary key\n    full_name string\n\nconstituency:\n    id integer primary key\n    type string\n    name string\n    os_name string\n\nelection:\n    id integer primary key\n    type string\n    label string\n\nturnout:\n    id integer primary key\n    election_id integer foreign_key(election.id)\n    constituency_id integer foreign_key(constituency.id)\n    turnout integer\n    \nvotes:\n    id integer primary key\n    candidate_id integer foreign_key(candidate.id)\n    constituency_id integer foreign_key(constituency.id)\n    election_id integer foreign_key(election.id)\n    votes integer\n    vote_change_percentage real\n    party string\n```\n\nvim: tw=0:nowrap\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonrw%2Fuk-election-results-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonrw%2Fuk-election-results-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonrw%2Fuk-election-results-analysis/lists"}