Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"post_name": "Lancaster Gate",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"post_name": "Lancaster Gate",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"post_name": "Lancaster Gate",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
1 change: 1 addition & 0 deletions api/endpoints/v1/sandbox/sandbox-responses/AA12AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"post_name": "Lancaster Gate",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
1 change: 1 addition & 0 deletions api/endpoints/v1/sandbox/sandbox-responses/AA12AB.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"post_name": "Lancaster Gate",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
4 changes: 4 additions & 0 deletions api/endpoints/v1/sandbox/sandbox-responses/AA14AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"post_name": "London Borough of Lewisham",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"voting_system": {
"slug": "sv",
"name": "Supplementary Vote",
Expand Down Expand Up @@ -186,6 +187,7 @@
"post_name": "Blackheath",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"candidates": [
{
"list_position": null,
Expand Down Expand Up @@ -403,6 +405,7 @@
"post_name": "Blackheath",
"postal_voting_requirements": null,
"candidates_verified": false,
"by_election_reason": "",
"candidates": [
{
"list_position": null,
Expand Down Expand Up @@ -613,6 +616,7 @@
"post_name": "Lewisham East",
"postal_voting_requirements": null,
"candidates_verified": false,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
1 change: 1 addition & 0 deletions api/endpoints/v1/sandbox/sandbox-responses/AA15AA.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"post_name": "West Tyrone",
"postal_voting_requirements": null,
"candidates_verified": false,
"by_election_reason": "",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down
2 changes: 2 additions & 0 deletions api/endpoints/v1/sandbox/sandbox-responses/AB12CD.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"post_name": "London Borough of Lewisham",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"wcivf_url": "https://whocanivotefor.co.uk/elections/mayor.lewisham.2018-05-03/post-lewisham/london-borough-of-lewisham",
"voting_system": {
"slug": "sv",
Expand Down Expand Up @@ -264,6 +265,7 @@
"post_name": "Blackheath",
"postal_voting_requirements": null,
"candidates_verified": true,
"by_election_reason": "",
"wcivf_url": "https://whocanivotefor.co.uk/elections/local.lewisham.2018-05-03/post-LBW:E05000438/blackheath",
"voting_system": {
"slug": "FPTP",
Expand Down
4 changes: 3 additions & 1 deletion api/endpoints/v1/voting_information/stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ def make_result_known_response(self):
ballot["postal_voting_requirements"] = wcivf_ballot.get(
"postal_voting_requirements", None
)

ballot["by_election_reason"] = wcivf_ballot.get(
"by_election_reason", ""
)
# We only sort by organisation_type at the moment, but we
# could add more values here to sort by more fields
self.ballot_sort_keys[ballot["ballot_paper_id"]] = wcivf_ballot[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@
+ `UNDER_CONTESTED`
+ `CANDIDATE_DEATH`

## ByElectionReason (enum)
+ `DEATH`
+ `RESIGNATION`
+ `ELECTORAL_COURT`
+ `FAILURE_TO_ACCEPT`
+ `FAILURE_TO_ATTEND_MEETINGS`
+ `DISQUALIFICATION`
+ `LOSING_QUALIFICATION`
+ `RECALL_PETITION`
+ `OTHER`
+ `UNKNOWN`
* `` - A blank response denotes 'NOT_APPLICABLE' - i.e. neither a by election nor a ballot.

## ValidFinderResponse (object)
+ `address_picker`: `false` (boolean) - True if we need to show this user an address picker
Expand Down Expand Up @@ -103,6 +115,7 @@
+ `election_name`: `Cardiff local election` (string) - Friendly name for this ballot's parent election group
+ `post_name`: `Pontprennau/Old St. Mellons` (string) - Name of the division or post the winner(s) of this election will represent
+ `candidates_verified`: `false` (boolean) - True if the list of candidates for this election has been confirmed against the nomination papers for this ballot. If this property is False, the candidate list is provisional or unconfirmed.
+ `by_election_reason`: (ByElectionReason) - reason by election was triggered. A blank response denotes 'NOT_APPLICABLE' - i.e. neither a by election nor a ballot.
+ `voting_system` (object) - The voting system used in this election
+ `slug`: `FPTP` (string) - One of `AMS`, `FPTP`, `PR-CL`, `sv`, `STV`
+ `name`: `First-past-the-post` (string) - The name of this voting system (e.g: "First-past-the-post")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
"election_name": "Cardiff local election",
"post_name": "Pontprennau/Old St. Mellons",
"candidates_verified": false,
"by_election_reason": "DEATH",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down Expand Up @@ -669,6 +670,23 @@
"type": "boolean",
"description": "True if the list of candidates for this election has been confirmed against the nomination papers for this ballot. If this property is False, the candidate list is provisional or unconfirmed."
},
"by_election_reason": {
"type": "string",
"enum": [
"DEATH",
"RESIGNATION",
"ELECTORAL_COURT",
"FAILURE_TO_ACCEPT",
"FAILURE_TO_ATTEND_MEETINGS",
"DISQUALIFICATION",
"LOSING_QUALIFICATION",
"RECALL_PETITION",
"OTHER",
"UNKNOWN",
"``"
],
"description": "reason by election was triggered. A blank response denotes 'NOT_APPLICABLE' - i.e. neither a by election nor a ballot."
},
"voting_system": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1292,6 +1310,7 @@
"election_name": "Cardiff local election",
"post_name": "Pontprennau/Old St. Mellons",
"candidates_verified": false,
"by_election_reason": "DEATH",
"voting_system": {
"slug": "FPTP",
"name": "First-past-the-post",
Expand Down Expand Up @@ -1659,6 +1678,23 @@
"type": "boolean",
"description": "True if the list of candidates for this election has been confirmed against the nomination papers for this ballot. If this property is False, the candidate list is provisional or unconfirmed."
},
"by_election_reason": {
"type": "string",
"enum": [
"DEATH",
"RESIGNATION",
"ELECTORAL_COURT",
"FAILURE_TO_ACCEPT",
"FAILURE_TO_ATTEND_MEETINGS",
"DISQUALIFICATION",
"LOSING_QUALIFICATION",
"RECALL_PETITION",
"OTHER",
"UNKNOWN",
"``"
],
"description": "reason by election was triggered. A blank response denotes 'NOT_APPLICABLE' - i.e. neither a by election nor a ballot."
},
"voting_system": {
"type": "object",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dev = [
]

[tool.uv.sources]
dc-response-builder = { git = "https://github.com/DemocracyClub/dc_response_builder.git", tag = "1.1.2" }
dc-response-builder = { git = "https://github.com/DemocracyClub/dc_response_builder.git", tag = "1.2.0" }

[tool.uv]
required-version = "==0.8.*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@
}
}
],
"ballot_paper_id": "local.lewisham.blackheath.2018-05-03"
"ballot_paper_id": "local.lewisham.blackheath.2018-05-03",
"by_election_reason": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@
}
}
],
"ballot_paper_id": "local.lewisham.blackheath.2018-05-10"
"ballot_paper_id": "local.lewisham.blackheath.2018-05-10",
"by_election_reason": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,6 @@
}
}
],
"ballot_paper_id": "mayor.lewisham.2018-05-03"
"ballot_paper_id": "mayor.lewisham.2018-05-03",
"by_election_reason": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"organisation_type": "parl",
"candidates_verified": false,
"candidates": [],
"ballot_paper_id": "parl.lewisham-east.by.2018-06-14"
"ballot_paper_id": "parl.lewisham-east.by.2018-06-14",
"by_election_reason": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@
}
}
],
"ballot_paper_id": "local.westminster.lancaster-gate.by.2018-11-22"
"ballot_paper_id": "local.westminster.lancaster-gate.by.2018-11-22",
"by_election_reason": ""
}
12 changes: 6 additions & 6 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.