Skip to content

Commit

Permalink
Fix villages data
Browse files Browse the repository at this point in the history
  • Loading branch information
prasastoadi committed Nov 7, 2016
1 parent c101ef2 commit fa76367
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions csv/villages.csv
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@
1105130118,1105130,KUALA IDI
1105130119,1105130,KEUTAPANG MAMEH
1105130120,1105130,ULEE BLANG
1105130121,1105130,ALUE DUA MUKA 0
1105130121,1105130,ALUE DUA MUKA O
1105130122,1105130,KUTA LAWAH
1105131001,1105131,ASAN RAMPAK
1105131002,1105131,BUKET KUTA
Expand Down Expand Up @@ -42033,7 +42033,7 @@
3506190007,3506190,MENANG
3506190008,3506190,TENGGER KIDUL
3506190009,3506190,SEMANDING
3506190010,3506190,SITIMERT0
3506190010,3506190,SITIMERTO
3506190011,3506190,PAGU
3506190012,3506190,BENDO
3506190013,3506190,JAGUNG
Expand Down
6 changes: 6 additions & 0 deletions scripts/mdf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def process_buffer(buf):
villages_dict[village_id] = village_name


def fix_villages(villages):
for key, value in villages.items():
villages_dict[key] = value


def write_data_to_csv(tmp_dir, key):
print 'Writing provinces data...'
write_dict_to_csv(tmp_dir + '/provinces-' + key + '.csv', provinces_dict)
Expand All @@ -72,6 +77,7 @@ def write_dict_to_csv(fname, data_dict, upper_level_key_length=0):
def main(argv):
if (len(argv) > 0):
read_html_data(argv[0] + '/' + argv[1])
fix_villages({1105130121: 'ALUE DUA MUKA O', 3506190010: 'SITIMERTO'})
write_data_to_csv(argv[0], argv[2])
else:
print "usage: mdf_parser.py <directory> <html_input_file> <key>"
Expand Down

0 comments on commit fa76367

Please sign in to comment.