-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgenerate_dapil_kab_csv.py
24 lines (20 loc) · 1015 Bytes
/
generate_dapil_kab_csv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import get_provinsi
import get_kabupaten
import get_dapil_kab
from util_logging import *
from Constants import *
message_string = "====== START :: GENERATE DATA DAPIL DPRD KAB ======"
print(message_string)
pecker(LOG_DAPIL_KAB_DATA, message_string)
total_data_generated = 0
for dataProv in get_provinsi.getData():
for dataKab in get_kabupaten.getData(str(dataProv['idWilayah']), dataProv['namaWilayah'] ):
data_generated = get_dapil_kab.generateCSV(str(dataKab['idWilayah']), dataKab['namaWilayah'], str(dataProv['idWilayah']), dataProv['namaWilayah'])
if data_generated == 0:
message_string = "WARNING !!! 0 data in idKab=({}), idPro=({})".format(str(dataKab['idWilayah']), str(dataProv['idWilayah']))
print(message_string)
pecker(LOG_DAPIL_KAB_DATA, message_string)
total_data_generated += data_generated
message_string = "====== END :: GENERATE DATA DAPIL DPRD KAB, {} data generated ======".format(str(total_data_generated))
print(message_string)
pecker(LOG_DAPIL_KAB_DATA, message_string)