Skip to content

Commit 7a404db

Browse files
committed
Support multiple city names at import of addok-fr, and more clean
1 parent baad8f4 commit 7a404db

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

docker/builder/initialize-fr.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ docker compose run --rm addok-fr bash -c "\\
1919
# Duplicate entry, one for each postcode
2020
# https://github.com/addok/addok/issues/811
2121
zcat /addresses/bano.sjson.gz | \\
22-
jq -c '. | select(.type==\"city\" or .type==\"town\" or .type==\"village\") | . + {citycode: (.citycode // .id) } | (. + {postcode: .postcode | (if type!=\"array\" then . else .[] end)})' | \\
22+
jq -c '. | select(.type==\"city\" or .type==\"town\" or .type==\"village\")' | \\
23+
jq -c 'del(.departement) | del(.region)' | \\
24+
jq -c '. + {citycode: (.citycode // .id) } | (. + {postcode: .postcode | (if type!=\"array\" then . else .[] end)}) | (. + {city: .city | (if type!=\"array\" then . else .[] end)})' | \\
2325
jq -c 'def mapping: {\"city\":\"municipality\",\"town\":\"municipality\",\"village\":\"municipality\",\"place\":\"locality\",\"street\":\"street\"}; . + {type: mapping[.type]}' | \\
2426
addok batch"
2527

2628
docker compose run --rm addok-fr bash -c "\\
2729
zcat /addresses/bano.sjson.gz | \\
28-
jq -c '. | select(.type==\"place\" or .type==\"street\") | . + {citycode: (.citycode // .id) }' | \\
30+
jq -c '. | select(.type==\"place\" or .type==\"street\")' | \\
31+
jq -c 'del(.departement) | del(.region) | del(.housenumbers[]?.id)' | \\
32+
jq -c '. + {citycode: (.citycode // .id) } | (. + {city: .city | (if type!=\"array\" then . else .[] end)})' | \\
2933
jq -c 'def mapping: {\"city\":\"municipality\",\"town\":\"municipality\",\"village\":\"municipality\",\"place\":\"locality\",\"street\":\"street\"}; . + {type: mapping[.type]}' | \\
30-
jq -c 'del(.housenumbers[]?.id)' | \\
3134
addok batch"
3235

33-
# # Patch BANO
36+
# Patch BANO
3437
docker compose run --rm --entrypoint /bin/bash addok-fr -c "ls ./addresses/*.*json | xargs cat | addok batch"
3538

3639
docker compose run --rm addok-fr addok ngrams

0 commit comments

Comments
 (0)