Skip to content

Commit

Permalink
fix: keep known good locodes
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Prodromou <[email protected]>
  • Loading branch information
evanp committed Mar 21, 2024
1 parent 1136129 commit 5e9af68
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions harmonize/data/processed/UNLOCODE_2023-2/Actor.csv
Original file line number Diff line number Diff line change
Expand Up @@ -55352,6 +55352,7 @@ GB BEO,city,Burrelton,GB-PKN,UNLOCODE:2023-2
GB B39,city,Burridge,GB-HAM,UNLOCODE:2023-2
GB BWR,city,Burrow,GB-SOM,UNLOCODE:2023-2
GB BBI,city,Burrowbridge,GB-SOM,UNLOCODE:2023-2
GB BPT,city,Burry Port,GB-CMN,UNLOCODE:2023-2
GB BGH,city,Burscough,GB-LAN,UNLOCODE:2023-2
GB BUE,city,Bursledon,GB-HAM,UNLOCODE:2023-2
GB BEM,city,Burslem,GB-STS,UNLOCODE:2023-2
Expand Down
1 change: 0 additions & 1 deletion harmonize/data/processed/UNLOCODE_2023-2/Actor.delete.csv
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ FR ORY
FR LYS
GA MBY
GA OGU
GB BPT
GB EMA
GB ELL
GB LGW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55352,6 +55352,7 @@ GB BEO,GB BEO,UNLOCODE,UNLOCODE:2023-2
GB B39,GB B39,UNLOCODE,UNLOCODE:2023-2
GB BWR,GB BWR,UNLOCODE,UNLOCODE:2023-2
GB BBI,GB BBI,UNLOCODE,UNLOCODE:2023-2
GB BPT,GB BPT,UNLOCODE,UNLOCODE:2023-2
GB BGH,GB BGH,UNLOCODE,UNLOCODE:2023-2
GB BUE,GB BUE,UNLOCODE,UNLOCODE:2023-2
GB BEM,GB BEM,UNLOCODE,UNLOCODE:2023-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ FR ORY
FR LYS
GA MBY
GA OGU
GB BPT
GB EMA
GB ELL
GB LGW
Expand Down
1 change: 1 addition & 0 deletions harmonize/data/processed/UNLOCODE_2023-2/ActorName.csv
Original file line number Diff line number Diff line change
Expand Up @@ -64766,6 +64766,7 @@ GB BEO,Burrelton,und,0,UNLOCODE:2023-2
GB B39,Burridge,und,0,UNLOCODE:2023-2
GB BWR,Burrow,und,0,UNLOCODE:2023-2
GB BBI,Burrowbridge,und,0,UNLOCODE:2023-2
GB BPT,Burry Port,und,0,UNLOCODE:2023-2
GB BGH,Burscough,und,0,UNLOCODE:2023-2
GB BUE,Bursledon,und,0,UNLOCODE:2023-2
GB BEM,Burslem,und,0,UNLOCODE:2023-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ FR ORY
FR LYS
GA MBY
GA OGU
GB BPT
GB EMA
GB ELL
GB LGW
Expand Down
1 change: 1 addition & 0 deletions harmonize/data/processed/UNLOCODE_2023-2/Territory.csv
Original file line number Diff line number Diff line change
Expand Up @@ -49363,6 +49363,7 @@ GB BVO,604833,-10167,UNLOCODE:2023-2
GB BUF,588500,-29167,UNLOCODE:2023-2
GB B39,508833,-12500,UNLOCODE:2023-2
GB BBI,510667,-29167,UNLOCODE:2023-2
GB BPT,516833,-42500,UNLOCODE:2023-2
GB BGH,535833,-28333,UNLOCODE:2023-2
GB UTO,524000,11500,UNLOCODE:2023-2
GB KBK,537333,-1333,UNLOCODE:2023-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ FR ORY
FR LYS
GA MBY
GA OGU
GB BPT
GB EMA
GB ELL
GB LGW
Expand Down
9 changes: 8 additions & 1 deletion harmonize/scripts/process_unlocode_2023.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
"type"
]

# Known good UNLOCODEs that we want to keep

KNOWN_GOOD = [
'GB BPT',
'GB ELL'
'AU PBN'
]

def write_csv(name, rows):
with open(f'{OUTPUT_DIR}/{name}.csv', mode='w') as csvfile:
Expand Down Expand Up @@ -138,7 +145,7 @@ def handle_input_row(row, subdivs):
'|.+Airport'
)

if re.search(regex, row["Name"]) or row["ISO 3166-1"].strip() == "XZ":
if (re.search(regex, row["Name"]) or row["ISO 3166-1"].strip() == "XZ") and not actor_id in KNOWN_GOOD:
# We want to delete bad existing rows

write_output_row("Actor.delete", ["actor_id"], {
Expand Down

0 comments on commit 5e9af68

Please sign in to comment.