Compare commits
3 Commits
e56fc253ba
...
fff24136a1
| Author | SHA1 | Date | |
|---|---|---|---|
| fff24136a1 | |||
| 45eba00d5d | |||
| 0f05fe20ec |
@@ -35,7 +35,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:
|
||||
|
||||
```
|
||||
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
|
||||
jq '[.[] | {name: .electorateName, electorateId: .electorateId, shortName: .parentElectorateName | match("(.*?)(?:(?: Rural)?(?: City| Shire| Borough) 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
|
||||
```
|
||||
|
||||
## lga-links-filter
|
||||
|
||||
@@ -786,6 +786,14 @@
|
||||
"Beaufort"
|
||||
]
|
||||
},
|
||||
{
|
||||
"shortName": "Queenscliffe",
|
||||
"slug": "queenscliffe",
|
||||
"councilName": "Queenscliffe Borough Council",
|
||||
"wardNames": [
|
||||
"Unsubdivided"
|
||||
]
|
||||
},
|
||||
{
|
||||
"shortName": "South Gippsland",
|
||||
"slug": "south-gippsland",
|
||||
|
||||
@@ -96,19 +96,23 @@ if (($handle = fopen($inputFile, "r")) !== FALSE) {
|
||||
|
||||
//print("Adding candidate " . $candidateName . " to ". $currentWard . "\n");
|
||||
|
||||
$name_split = explode(" ", str_replace(",", "", str_replace("'", "_", $data[1])));
|
||||
$name_split = array_values(array_filter(explode(" ", str_replace(",", "", str_replace("'", "_", $data[1]))), function($value) { return !is_null($value) && $value !== ''; }));
|
||||
|
||||
$name_patterns = [
|
||||
implode(".*", $name_split),
|
||||
implode(".*", array_reverse($name_split)),
|
||||
".*" . implode(".*", $name_split) . ".*",
|
||||
".*" . implode(".*", array_reverse($name_split)) . ".*",
|
||||
"^" . $name_split[array_key_last($name_split)] . ".*",
|
||||
"^" . $name_split[0] . ".*"
|
||||
];
|
||||
|
||||
$regex_groups = array_map(function($x) { return "(?:.*" . $x . ".*)"; }, $name_patterns);
|
||||
$regex_groups = array_map(function($x) { return "(?:" . $x . ")"; }, $name_patterns);
|
||||
|
||||
$regex_pattern = "/" . implode("|", $regex_groups) . "/i";
|
||||
|
||||
$picture = "";
|
||||
foreach ($mediaFiles as $mediaFile) {
|
||||
if ($mediaFile == ".") continue;
|
||||
if ($mediaFile == "..") continue;
|
||||
if (preg_match($regex_pattern, $mediaFile)) {
|
||||
$picture = $mediaFile;
|
||||
break;
|
||||
|
||||
2
map-generator/dist/main.js
vendored
2
map-generator/dist/main.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
import polylabel from 'polylabel';
|
||||
|
||||
function normaliseCouncilName(str) {
|
||||
const regex = /(.*?)(?:(?: Rural)?(?: City| Shire) Council)/g;
|
||||
const regex = /(.*?)(?:(?: Rural)?(?: City| Shire| Borough) Council)/g;
|
||||
const matches = str.matchAll(regex);
|
||||
|
||||
// If we get a match, convert to slug format
|
||||
|
||||
Reference in New Issue
Block a user