Compare commits
7 Commits
0002b0cefb
...
f1aca43042
| Author | SHA1 | Date | |
|---|---|---|---|
| f1aca43042 | |||
| 09ffd40bf7 | |||
| 89a5224af2 | |||
| a29a66a656 | |||
| 356ebd6524 | |||
| e7574e7ef8 | |||
| 5a4f420b88 |
@@ -11,7 +11,7 @@ The "short" named is created by taking the electorate name and removing the word
|
|||||||
The file can be generated using the `jq` tool and the VEC data:
|
The file can be generated using the `jq` tool and the VEC data:
|
||||||
|
|
||||||
```
|
```
|
||||||
jq '[.[] | {name: .electorateName, electorateId: .electorateId, shortName: .parentElectorateName | match("(.*?)(?:(?: Rural)?(?: City| Shire) Council)").captures[0].string, parentElectorateId: .parentElectorateId, councilName: .parentElectorateName }] | group_by(.parentElectorateId) | map({shortName: .[0].shortName, councilName: .[0].councilName, wardNames: . | map(.name) }) | sort_by(.shortName)' "VEC Data\wards.json" > council_names.json
|
jq '[.[] | {name: .electorateName, electorateId: .electorateId, shortName: .parentElectorateName | match("(.*?)(?:(?: Rural)?(?: City| Shire) Council)").captures[0].string, parentElectorateId: .parentElectorateId, councilName: .parentElectorateName }] | group_by(.parentElectorateId) | map({shortName: .[0].shortName, slug: .[0].shortName | ascii_downcase | split(" ") | join("-"), councilName: .[0].councilName, wardNames: . | map(.name) }) | sort_by(.shortName)' "VEC Data\wards.json" > council_names.json
|
||||||
```
|
```
|
||||||
|
|
||||||
## make-council-pages.sh
|
## make-council-pages.sh
|
||||||
|
|||||||
3
candidates/brimbank.csv
Normal file
3
candidates/brimbank.csv
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Council,Ward,Candidate Name,Rating
|
||||||
|
Brimbank,Harvester,Joe Blogs,1
|
||||||
|
Brimbank,Harvester,Jane Doe,5
|
||||||
|
3
candidates/greater-geelong.csv
Normal file
3
candidates/greater-geelong.csv
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Council,Ward,Candidate Name,Rating
|
||||||
|
Brimbank,Harvester,Joe Blogs,1
|
||||||
|
Brimbank,Harvester,Jane Doe,5
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"shortName": "Alpine",
|
"shortName": "Alpine",
|
||||||
|
"slug": "alpine",
|
||||||
"councilName": "Alpine Shire Council",
|
"councilName": "Alpine Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Ararat",
|
"shortName": "Ararat",
|
||||||
|
"slug": "ararat",
|
||||||
"councilName": "Ararat Rural City Council",
|
"councilName": "Ararat Rural City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -15,6 +17,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Ballarat",
|
"shortName": "Ballarat",
|
||||||
|
"slug": "ballarat",
|
||||||
"councilName": "Ballarat City Council",
|
"councilName": "Ballarat City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Alfredton",
|
"Alfredton",
|
||||||
@@ -30,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Banyule",
|
"shortName": "Banyule",
|
||||||
|
"slug": "banyule",
|
||||||
"councilName": "Banyule City Council",
|
"councilName": "Banyule City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Ibbott",
|
"Ibbott",
|
||||||
@@ -45,6 +49,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Bass Coast",
|
"shortName": "Bass Coast",
|
||||||
|
"slug": "bass-coast",
|
||||||
"councilName": "Bass Coast Shire Council",
|
"councilName": "Bass Coast Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Bunurong",
|
"Bunurong",
|
||||||
@@ -54,6 +59,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Baw Baw",
|
"shortName": "Baw Baw",
|
||||||
|
"slug": "baw-baw",
|
||||||
"councilName": "Baw Baw Shire Council",
|
"councilName": "Baw Baw Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Central",
|
"Central",
|
||||||
@@ -63,6 +69,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Bayside",
|
"shortName": "Bayside",
|
||||||
|
"slug": "bayside",
|
||||||
"councilName": "Bayside City Council",
|
"councilName": "Bayside City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Dendy",
|
"Dendy",
|
||||||
@@ -76,6 +83,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Benalla",
|
"shortName": "Benalla",
|
||||||
|
"slug": "benalla",
|
||||||
"councilName": "Benalla Rural City Council",
|
"councilName": "Benalla Rural City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -83,6 +91,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Boroondara",
|
"shortName": "Boroondara",
|
||||||
|
"slug": "boroondara",
|
||||||
"councilName": "Boroondara City Council",
|
"councilName": "Boroondara City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Maling",
|
"Maling",
|
||||||
@@ -100,6 +109,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Brimbank",
|
"shortName": "Brimbank",
|
||||||
|
"slug": "brimbank",
|
||||||
"councilName": "Brimbank City Council",
|
"councilName": "Brimbank City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Harvester",
|
"Harvester",
|
||||||
@@ -117,6 +127,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Buloke",
|
"shortName": "Buloke",
|
||||||
|
"slug": "buloke",
|
||||||
"councilName": "Buloke Shire Council",
|
"councilName": "Buloke Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Mallee",
|
"Mallee",
|
||||||
@@ -126,6 +137,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Campaspe",
|
"shortName": "Campaspe",
|
||||||
|
"slug": "campaspe",
|
||||||
"councilName": "Campaspe Shire Council",
|
"councilName": "Campaspe Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -133,6 +145,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Cardinia",
|
"shortName": "Cardinia",
|
||||||
|
"slug": "cardinia",
|
||||||
"councilName": "Cardinia Shire Council",
|
"councilName": "Cardinia Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Bunyip",
|
"Bunyip",
|
||||||
@@ -148,6 +161,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Casey",
|
"shortName": "Casey",
|
||||||
|
"slug": "casey",
|
||||||
"councilName": "Casey City Council",
|
"councilName": "Casey City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Waratah",
|
"Waratah",
|
||||||
@@ -166,6 +180,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Central Goldfields",
|
"shortName": "Central Goldfields",
|
||||||
|
"slug": "central-goldfields",
|
||||||
"councilName": "Central Goldfields Shire Council",
|
"councilName": "Central Goldfields Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Tullaroop",
|
"Tullaroop",
|
||||||
@@ -179,6 +194,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Colac Otway",
|
"shortName": "Colac Otway",
|
||||||
|
"slug": "colac-otway",
|
||||||
"councilName": "Colac Otway Shire Council",
|
"councilName": "Colac Otway Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -186,6 +202,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Corangamite",
|
"shortName": "Corangamite",
|
||||||
|
"slug": "corangamite",
|
||||||
"councilName": "Corangamite Shire Council",
|
"councilName": "Corangamite Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Lake Elingamite",
|
"Lake Elingamite",
|
||||||
@@ -199,6 +216,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Darebin",
|
"shortName": "Darebin",
|
||||||
|
"slug": "darebin",
|
||||||
"councilName": "Darebin City Council",
|
"councilName": "Darebin City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"South",
|
"South",
|
||||||
@@ -214,6 +232,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "East Gippsland",
|
"shortName": "East Gippsland",
|
||||||
|
"slug": "east-gippsland",
|
||||||
"councilName": "East Gippsland Shire Council",
|
"councilName": "East Gippsland Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -221,6 +240,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Frankston",
|
"shortName": "Frankston",
|
||||||
|
"slug": "frankston",
|
||||||
"councilName": "Frankston City Council",
|
"councilName": "Frankston City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Centenary Park",
|
"Centenary Park",
|
||||||
@@ -236,6 +256,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Gannawarra",
|
"shortName": "Gannawarra",
|
||||||
|
"slug": "gannawarra",
|
||||||
"councilName": "Gannawarra Shire Council",
|
"councilName": "Gannawarra Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -243,6 +264,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Glen Eira",
|
"shortName": "Glen Eira",
|
||||||
|
"slug": "glen-eira",
|
||||||
"councilName": "Glen Eira City Council",
|
"councilName": "Glen Eira City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Moorleigh",
|
"Moorleigh",
|
||||||
@@ -258,6 +280,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Glenelg",
|
"shortName": "Glenelg",
|
||||||
|
"slug": "glenelg",
|
||||||
"councilName": "Glenelg Shire Council",
|
"councilName": "Glenelg Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -265,6 +288,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Golden Plains",
|
"shortName": "Golden Plains",
|
||||||
|
"slug": "golden-plains",
|
||||||
"councilName": "Golden Plains Shire Council",
|
"councilName": "Golden Plains Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -272,6 +296,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Greater Bendigo",
|
"shortName": "Greater Bendigo",
|
||||||
|
"slug": "greater-bendigo",
|
||||||
"councilName": "Greater Bendigo City Council",
|
"councilName": "Greater Bendigo City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Golden Square",
|
"Golden Square",
|
||||||
@@ -287,6 +312,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Greater Dandenong",
|
"shortName": "Greater Dandenong",
|
||||||
|
"slug": "greater-dandenong",
|
||||||
"councilName": "Greater Dandenong City Council",
|
"councilName": "Greater Dandenong City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Dandenong",
|
"Dandenong",
|
||||||
@@ -304,6 +330,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Greater Geelong",
|
"shortName": "Greater Geelong",
|
||||||
|
"slug": "greater-geelong",
|
||||||
"councilName": "Greater Geelong City Council",
|
"councilName": "Greater Geelong City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Kardinia",
|
"Kardinia",
|
||||||
@@ -321,6 +348,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Greater Shepparton",
|
"shortName": "Greater Shepparton",
|
||||||
|
"slug": "greater-shepparton",
|
||||||
"councilName": "Greater Shepparton City Council",
|
"councilName": "Greater Shepparton City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Midland",
|
"Midland",
|
||||||
@@ -336,6 +364,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Hepburn",
|
"shortName": "Hepburn",
|
||||||
|
"slug": "hepburn",
|
||||||
"councilName": "Hepburn Shire Council",
|
"councilName": "Hepburn Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -343,6 +372,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Hindmarsh",
|
"shortName": "Hindmarsh",
|
||||||
|
"slug": "hindmarsh",
|
||||||
"councilName": "Hindmarsh Shire Council",
|
"councilName": "Hindmarsh Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"North",
|
"North",
|
||||||
@@ -352,6 +382,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Hobsons Bay",
|
"shortName": "Hobsons Bay",
|
||||||
|
"slug": "hobsons-bay",
|
||||||
"councilName": "Hobsons Bay City Council",
|
"councilName": "Hobsons Bay City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Laverton",
|
"Laverton",
|
||||||
@@ -365,6 +396,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Horsham",
|
"shortName": "Horsham",
|
||||||
|
"slug": "horsham",
|
||||||
"councilName": "Horsham Rural City Council",
|
"councilName": "Horsham Rural City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Horsham North",
|
"Horsham North",
|
||||||
@@ -378,6 +410,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Hume",
|
"shortName": "Hume",
|
||||||
|
"slug": "hume",
|
||||||
"councilName": "Hume City Council",
|
"councilName": "Hume City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Burt-kur-min",
|
"Burt-kur-min",
|
||||||
@@ -395,6 +428,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Indigo",
|
"shortName": "Indigo",
|
||||||
|
"slug": "indigo",
|
||||||
"councilName": "Indigo Shire Council",
|
"councilName": "Indigo Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -402,6 +436,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Kingston",
|
"shortName": "Kingston",
|
||||||
|
"slug": "kingston",
|
||||||
"councilName": "Kingston City Council",
|
"councilName": "Kingston City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Wattle",
|
"Wattle",
|
||||||
@@ -419,6 +454,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Knox",
|
"shortName": "Knox",
|
||||||
|
"slug": "knox",
|
||||||
"councilName": "Knox City Council",
|
"councilName": "Knox City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Chandler",
|
"Chandler",
|
||||||
@@ -434,6 +470,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Latrobe",
|
"shortName": "Latrobe",
|
||||||
|
"slug": "latrobe",
|
||||||
"councilName": "Latrobe City Council",
|
"councilName": "Latrobe City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Jeeralang",
|
"Jeeralang",
|
||||||
@@ -449,6 +486,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Loddon",
|
"shortName": "Loddon",
|
||||||
|
"slug": "loddon",
|
||||||
"councilName": "Loddon Shire Council",
|
"councilName": "Loddon Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Terrick",
|
"Terrick",
|
||||||
@@ -460,6 +498,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Macedon Ranges",
|
"shortName": "Macedon Ranges",
|
||||||
|
"slug": "macedon-ranges",
|
||||||
"councilName": "Macedon Ranges Shire Council",
|
"councilName": "Macedon Ranges Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"West",
|
"West",
|
||||||
@@ -469,6 +508,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Manningham",
|
"shortName": "Manningham",
|
||||||
|
"slug": "manningham",
|
||||||
"councilName": "Manningham City Council",
|
"councilName": "Manningham City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Schramm",
|
"Schramm",
|
||||||
@@ -484,6 +524,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Mansfield",
|
"shortName": "Mansfield",
|
||||||
|
"slug": "mansfield",
|
||||||
"councilName": "Mansfield Shire Council",
|
"councilName": "Mansfield Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -491,6 +532,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Maribyrnong",
|
"shortName": "Maribyrnong",
|
||||||
|
"slug": "maribyrnong",
|
||||||
"councilName": "Maribyrnong City Council",
|
"councilName": "Maribyrnong City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Braybrook",
|
"Braybrook",
|
||||||
@@ -504,6 +546,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Maroondah",
|
"shortName": "Maroondah",
|
||||||
|
"slug": "maroondah",
|
||||||
"councilName": "Maroondah City Council",
|
"councilName": "Maroondah City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Yarrunga",
|
"Yarrunga",
|
||||||
@@ -519,6 +562,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Melbourne",
|
"shortName": "Melbourne",
|
||||||
|
"slug": "melbourne",
|
||||||
"councilName": "Melbourne City Council",
|
"councilName": "Melbourne City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -526,6 +570,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Melton",
|
"shortName": "Melton",
|
||||||
|
"slug": "melton",
|
||||||
"councilName": "Melton City Council",
|
"councilName": "Melton City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Jackwood",
|
"Jackwood",
|
||||||
@@ -542,6 +587,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Merri-bek",
|
"shortName": "Merri-bek",
|
||||||
|
"slug": "merri-bek",
|
||||||
"councilName": "Merri-bek City Council",
|
"councilName": "Merri-bek City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Harmony Park",
|
"Harmony Park",
|
||||||
@@ -559,6 +605,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Mildura",
|
"shortName": "Mildura",
|
||||||
|
"slug": "mildura",
|
||||||
"councilName": "Mildura Rural City Council",
|
"councilName": "Mildura Rural City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Millewa",
|
"Millewa",
|
||||||
@@ -574,6 +621,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Mitchell",
|
"shortName": "Mitchell",
|
||||||
|
"slug": "mitchell",
|
||||||
"councilName": "Mitchell Shire Council",
|
"councilName": "Mitchell Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"South",
|
"South",
|
||||||
@@ -583,6 +631,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Moira",
|
"shortName": "Moira",
|
||||||
|
"slug": "moira",
|
||||||
"councilName": "Moira Shire Council",
|
"councilName": "Moira Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -590,6 +639,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Monash",
|
"shortName": "Monash",
|
||||||
|
"slug": "monash",
|
||||||
"councilName": "Monash City Council",
|
"councilName": "Monash City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Gardiners Creek",
|
"Gardiners Creek",
|
||||||
@@ -607,6 +657,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Moonee Valley",
|
"shortName": "Moonee Valley",
|
||||||
|
"slug": "moonee-valley",
|
||||||
"councilName": "Moonee Valley City Council",
|
"councilName": "Moonee Valley City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Steele Creek",
|
"Steele Creek",
|
||||||
@@ -622,6 +673,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Moorabool",
|
"shortName": "Moorabool",
|
||||||
|
"slug": "moorabool",
|
||||||
"councilName": "Moorabool Shire Council",
|
"councilName": "Moorabool Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -629,6 +681,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Mornington Peninsula",
|
"shortName": "Mornington Peninsula",
|
||||||
|
"slug": "mornington-peninsula",
|
||||||
"councilName": "Mornington Peninsula Shire Council",
|
"councilName": "Mornington Peninsula Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Briars",
|
"Briars",
|
||||||
@@ -646,6 +699,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Mount Alexander",
|
"shortName": "Mount Alexander",
|
||||||
|
"slug": "mount-alexander",
|
||||||
"councilName": "Mount Alexander Shire Council",
|
"councilName": "Mount Alexander Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Campbells Creek",
|
"Campbells Creek",
|
||||||
@@ -660,6 +714,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Moyne",
|
"shortName": "Moyne",
|
||||||
|
"slug": "moyne",
|
||||||
"councilName": "Moyne Shire Council",
|
"councilName": "Moyne Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -667,6 +722,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Murrindindi",
|
"shortName": "Murrindindi",
|
||||||
|
"slug": "murrindindi",
|
||||||
"councilName": "Murrindindi Shire Council",
|
"councilName": "Murrindindi Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Kinglake",
|
"Kinglake",
|
||||||
@@ -680,6 +736,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Nillumbik",
|
"shortName": "Nillumbik",
|
||||||
|
"slug": "nillumbik",
|
||||||
"councilName": "Nillumbik Shire Council",
|
"councilName": "Nillumbik Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Wingrove",
|
"Wingrove",
|
||||||
@@ -693,6 +750,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Northern Grampians",
|
"shortName": "Northern Grampians",
|
||||||
|
"slug": "northern-grampians",
|
||||||
"councilName": "Northern Grampians Shire Council",
|
"councilName": "Northern Grampians Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Kara Kara",
|
"Kara Kara",
|
||||||
@@ -702,6 +760,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Port Phillip",
|
"shortName": "Port Phillip",
|
||||||
|
"slug": "port-phillip",
|
||||||
"councilName": "Port Phillip City Council",
|
"councilName": "Port Phillip City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"St Kilda",
|
"St Kilda",
|
||||||
@@ -717,6 +776,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Pyrenees",
|
"shortName": "Pyrenees",
|
||||||
|
"slug": "pyrenees",
|
||||||
"councilName": "Pyrenees Shire Council",
|
"councilName": "Pyrenees Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Avoca",
|
"Avoca",
|
||||||
@@ -728,6 +788,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "South Gippsland",
|
"shortName": "South Gippsland",
|
||||||
|
"slug": "south-gippsland",
|
||||||
"councilName": "South Gippsland Shire Council",
|
"councilName": "South Gippsland Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Tarwin Valley",
|
"Tarwin Valley",
|
||||||
@@ -737,6 +798,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Southern Grampians",
|
"shortName": "Southern Grampians",
|
||||||
|
"slug": "southern-grampians",
|
||||||
"councilName": "Southern Grampians Shire Council",
|
"councilName": "Southern Grampians Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -744,6 +806,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Stonnington",
|
"shortName": "Stonnington",
|
||||||
|
"slug": "stonnington",
|
||||||
"councilName": "Stonnington City Council",
|
"councilName": "Stonnington City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Hedgeley Dene",
|
"Hedgeley Dene",
|
||||||
@@ -759,6 +822,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Strathbogie",
|
"shortName": "Strathbogie",
|
||||||
|
"slug": "strathbogie",
|
||||||
"councilName": "Strathbogie Shire Council",
|
"councilName": "Strathbogie Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -766,6 +830,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Surf Coast",
|
"shortName": "Surf Coast",
|
||||||
|
"slug": "surf-coast",
|
||||||
"councilName": "Surf Coast Shire Council",
|
"councilName": "Surf Coast Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Otway Range",
|
"Otway Range",
|
||||||
@@ -775,6 +840,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Swan Hill",
|
"shortName": "Swan Hill",
|
||||||
|
"slug": "swan-hill",
|
||||||
"councilName": "Swan Hill Rural City Council",
|
"councilName": "Swan Hill Rural City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -782,6 +848,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Towong",
|
"shortName": "Towong",
|
||||||
|
"slug": "towong",
|
||||||
"councilName": "Towong Shire Council",
|
"councilName": "Towong Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -789,6 +856,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Wangaratta",
|
"shortName": "Wangaratta",
|
||||||
|
"slug": "wangaratta",
|
||||||
"councilName": "Wangaratta Rural City Council",
|
"councilName": "Wangaratta Rural City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Ovens",
|
"Ovens",
|
||||||
@@ -802,6 +870,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Warrnambool",
|
"shortName": "Warrnambool",
|
||||||
|
"slug": "warrnambool",
|
||||||
"councilName": "Warrnambool City Council",
|
"councilName": "Warrnambool City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Botanic",
|
"Botanic",
|
||||||
@@ -815,6 +884,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Wellington",
|
"shortName": "Wellington",
|
||||||
|
"slug": "wellington",
|
||||||
"councilName": "Wellington Shire Council",
|
"councilName": "Wellington Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Northern",
|
"Northern",
|
||||||
@@ -824,6 +894,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "West Wimmera",
|
"shortName": "West Wimmera",
|
||||||
|
"slug": "west-wimmera",
|
||||||
"councilName": "West Wimmera Shire Council",
|
"councilName": "West Wimmera Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Unsubdivided"
|
"Unsubdivided"
|
||||||
@@ -831,6 +902,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Whitehorse",
|
"shortName": "Whitehorse",
|
||||||
|
"slug": "whitehorse",
|
||||||
"councilName": "Whitehorse City Council",
|
"councilName": "Whitehorse City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Cootamundra",
|
"Cootamundra",
|
||||||
@@ -848,6 +920,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Whittlesea",
|
"shortName": "Whittlesea",
|
||||||
|
"slug": "whittlesea",
|
||||||
"councilName": "Whittlesea City Council",
|
"councilName": "Whittlesea City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Mill Park",
|
"Mill Park",
|
||||||
@@ -865,6 +938,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Wodonga",
|
"shortName": "Wodonga",
|
||||||
|
"slug": "wodonga",
|
||||||
"councilName": "Wodonga City Council",
|
"councilName": "Wodonga City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Sumsion Gardens",
|
"Sumsion Gardens",
|
||||||
@@ -878,6 +952,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Wyndham",
|
"shortName": "Wyndham",
|
||||||
|
"slug": "wyndham",
|
||||||
"councilName": "Wyndham City Council",
|
"councilName": "Wyndham City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Iramoo",
|
"Iramoo",
|
||||||
@@ -895,6 +970,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Yarra",
|
"shortName": "Yarra",
|
||||||
|
"slug": "yarra",
|
||||||
"councilName": "Yarra City Council",
|
"councilName": "Yarra City Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Yarra Bend",
|
"Yarra Bend",
|
||||||
@@ -910,6 +986,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Yarra Ranges",
|
"shortName": "Yarra Ranges",
|
||||||
|
"slug": "yarra-ranges",
|
||||||
"councilName": "Yarra Ranges Shire Council",
|
"councilName": "Yarra Ranges Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Chirnside",
|
"Chirnside",
|
||||||
@@ -925,6 +1002,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"shortName": "Yarriambiack",
|
"shortName": "Yarriambiack",
|
||||||
|
"slug": "yarriambiack",
|
||||||
"councilName": "Yarriambiack Shire Council",
|
"councilName": "Yarriambiack Shire Council",
|
||||||
"wardNames": [
|
"wardNames": [
|
||||||
"Warracknabeal",
|
"Warracknabeal",
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
# This script uses the jq, wp, and php commands, make sure they are installed before running this script.
|
# This script uses the jq, wp, and php commands, make sure they are installed before running this script.
|
||||||
|
|
||||||
# The council_names.json file must contain a list of objects (one for each council).
|
# The council_names.json file must contain a list of objects (one for each council).
|
||||||
# Each object must have the following fields: "shortName", "councilName", and "wardNames"
|
# Each object must have the following fields: "shortName", "slug", "councilName", and "wardNames"
|
||||||
# The "shortName" field must be a string.
|
# The "shortName" field must be a string.
|
||||||
|
# The "slug" field must be a string.
|
||||||
# The "councilName" field must be a string.
|
# The "councilName" field must be a string.
|
||||||
# The "wardNames" field must be a list of strings.
|
# The "wardNames" field must be a list of strings.
|
||||||
JSON_FILE="council_names.json"
|
JSON_FILE="council_names.json"
|
||||||
@@ -18,7 +19,9 @@ function create_or_update_page() {
|
|||||||
|
|
||||||
short_name=$(echo "$council_block" | jq -r '.shortName')
|
short_name=$(echo "$council_block" | jq -r '.shortName')
|
||||||
|
|
||||||
content=$(echo "$council_block" | jq -c | php php-template/main.php)
|
slug=$(echo "$council_block" | jq -r '.slug')
|
||||||
|
|
||||||
|
content=$(echo "$council_block" | jq -c | php php-template/main.php --council-file "php://stdin" --candidates-file "candidates/$slug.csv")
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|
||||||
|
|||||||
2
php-template/.vscode/launch.json
vendored
2
php-template/.vscode/launch.json
vendored
@@ -6,7 +6,7 @@
|
|||||||
"type": "php",
|
"type": "php",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/main.php",
|
"program": "${workspaceFolder}/main.php",
|
||||||
"args": ["${workspaceFolder}/example-config.json", "${workspaceFolder}/example-candidates.csv"],
|
"args": ["--council-file", "${workspaceFolder}/example-config.json", "--candidates-file", "${workspaceFolder}/example-candidates.csv"],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"port": 9000
|
"port": 9000
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +1,57 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once "page_renderer.php";
|
require_once "page_renderer.php";
|
||||||
|
|
||||||
// TODO: Need to handle arguments better
|
$options = getopt("", ["council-file:", "candidates-file:"]);
|
||||||
// Assume that the first argument is a path to a file contain the config.
|
|
||||||
// If the argument isn't present, load the json from standard input
|
if (isset($options['council-file'])) {
|
||||||
if (isset($argv[1])) {
|
$councilFileContents = file_get_contents($options['council-file']);
|
||||||
$jsonData = file_get_contents($argv[1]);
|
|
||||||
} else {
|
} else {
|
||||||
$jsonData = file_get_contents("php://stdin");
|
error_log("Error: Missing required option '--council-file'.");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = json_decode($jsonData, true);
|
$councilData = json_decode($councilFileContents, true);
|
||||||
|
|
||||||
// Check for decoding errors
|
// Check for decoding errors
|
||||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||||
error_log('Error decoding JSON: ' . json_last_error_msg());
|
error_log('Error decoding council file: ' . json_last_error_msg());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($options['candidates-file'])) {
|
||||||
|
$candidatesFile = $options['candidates-file'];
|
||||||
|
} else {
|
||||||
|
error_log("Error: Missing required option '--candidates-file'.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert CSV into an array of dictionaries. Use the header as the key in the dictionary.
|
// Convert CSV into an array of dictionaries. Use the header as the key in the dictionary.
|
||||||
$candidates = [];
|
$candidateData = [];
|
||||||
if (isset($argv[2])) {
|
if (($handle = fopen($candidatesFile, "r")) !== FALSE) {
|
||||||
if (($handle = fopen($argv[2], "r")) !== FALSE) {
|
|
||||||
$headers = fgetcsv($handle);
|
$headers = fgetcsv($handle);
|
||||||
while (($data = fgetcsv($handle)) !== FALSE) {
|
while (($data = fgetcsv($handle)) !== FALSE) {
|
||||||
$candidate = [];
|
$candidate = [];
|
||||||
foreach ($headers as $key => $value) {
|
foreach ($headers as $key => $value) {
|
||||||
$candidate[$value] = $data[$key];
|
$candidate[$value] = $data[$key];
|
||||||
}
|
}
|
||||||
$candidates[] = $candidate;
|
$candidateData[] = $candidate;
|
||||||
}
|
}
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
} else {
|
} else {
|
||||||
error_log('Error opening CSV');
|
error_log('Error opening candidates file');
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check that candidates were read successfully??
|
$candidateData = array_filter($candidateData, function ($candidate) use ($councilData) {
|
||||||
|
return isset($candidate["Council"]) && $candidate["Council"] === $councilData['shortName'];
|
||||||
|
});
|
||||||
|
|
||||||
|
if (empty($candidateData)) {
|
||||||
|
error_log("Failed to load any candidates for " . $councilData['shortName']);
|
||||||
|
}
|
||||||
|
|
||||||
$renderer = new SPLPageRenderer();
|
$renderer = new SPLPageRenderer();
|
||||||
$pageContent = $renderer->renderCouncilPage($config, $candidates);
|
$pageContent = $renderer->renderCouncilPage($councilData, $candidateData);
|
||||||
if ($pageContent === null) {
|
if ($pageContent === null) {
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class SPLPageRenderer {
|
|||||||
|
|
||||||
set_error_handler(function($errno, $errstr, $errfile, $errline) {
|
set_error_handler(function($errno, $errstr, $errfile, $errline) {
|
||||||
// Clear any output if an error occurred
|
// Clear any output if an error occurred
|
||||||
ob_get_clean();
|
ob_clean();
|
||||||
error_log("Error: $errstr in $errfile on line $errline");
|
error_log("Error: $errstr in $errfile on line $errline");
|
||||||
return true; // Prevent default error handling
|
return true; // Prevent default error handling
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ $wardCandidates = array_filter($candidates, function ($candidate) use ($wardName
|
|||||||
|
|
||||||
if (count($wardCandidates) == 0) continue;
|
if (count($wardCandidates) == 0) continue;
|
||||||
?>
|
?>
|
||||||
<!-- wp:group {"layout":{"type":"grid"}} -->
|
<!-- wp:group {"layout":{"type":"grid","columnCount":3}} -->
|
||||||
<div class="wp-block-group">
|
<div class="wp-block-group">
|
||||||
<?php foreach ($wardCandidates as $index => $candidate): ?>
|
<?php foreach ($wardCandidates as $index => $candidate): ?>
|
||||||
<!-- wp:group {"layout":{"type":"flex","orientation":"vertical"}} -->
|
<!-- wp:group {"layout":{"type":"flex","orientation":"vertical"}} -->
|
||||||
|
|||||||
Reference in New Issue
Block a user