@@ -0,0 +1,2707 @@
+import os%0Aimport csv%0Aimport json%0Afrom django.conf import settings%0A%0A%0Achul_file = os.path.join(%0A    settings.BASE_DIR, 'data/csvs/chul.csv')%0A%0Atable_columns = %5B%0A    %22CommUnitId%22, %22Cu_code%22, %22CommUnitName%22, %22Date_CU_Established%22,%0A    %22Date_CU_Operational%22, %22CuLocation%22, %22Link_Facility_Code%22,%0A    %22CU_OfficialMobile%22, %22CU_OfficialEmail%22, %22Chew_Facility%22, %22Chew_In_Charge%22,%0A    %22NumHouseholds%22, %22CUStatus%22, %22Approved%22, %22ApprovedDate%22, %22ApprovedBy%22,%0A    %22ApprovalComments%22, %22isEdit%22, %22UnitRecordArchived%22, %22Date_added%22,%0A    %22Date_modified%22, %22Delete_comments%22%5D%0A%0A%0Adef create_chuls_file():%0A    chul = %5B%5D%0A    chews = %5B%5D%0A    chu_contacts = %5B%5D%0A    with open(chul_file, 'r') as csv_file:%0A        chul_reader = csv.reader(csv_file)%0A%0A        for row in chul_reader:%0A            code = row%5B1%5D%0A            name = row%5B2%5D%0A            date_established = row%5B3%5D%0A            facility_code = row%5B7%5D%0A            households_monitored = row%5B11%5D%0A            status = row%5B12%5D%0A            #  approval = row%5B13%5D%0A%0A            #  contacts%0A            mobile = row%5B7%5D%0A            mobile_dict = %7B%0A                %22contact%22: mobile,%0A                %22contact_type%22: %7B%0A                    %22PHONE%22%0A                %7D%0A            %7D%0A            email = row%5B8%5D%0A            email_dict = %7B%0A                %22contact%22: email,%0A                %22contact_type%22: %7B%0A                    %22EMAIL%22%0A                %7D%0A            %7D%0A            if email_dict not in chu_contacts:%0A                chu_contacts.append(email_dict)%0A            if mobile_dict not in chu_contacts:%0A                chu_contacts.append(email_dict)%0A%0A            # chew%0A            first_name = row%5B10%5D%0A%0A            chu = %7B%0A                %22code%22: code,%0A                %22name%22: name,%0A                %22date_established%22: date_established,%0A                %22facility%22: %7B%0A                    %22code%22: facility_code%0A                %7D,%0A                %22households_monitored%22: households_monitored,%0A                %22status%22: status,%0A            %7D%0A            if chu not in chul:%0A                chul.append(chu)%0A%0A            chew = %7B%0A                %22first_name%22: first_name,%0A                %22heath_unit%22: %7B%0A                    %22code%22: code%0A                %7D%0A            %7D%0A            if chew not in chews:%0A                chews.append(chew)%0A%0A    return chul, chews%0A%0A%0Adef write_file(file_name, data):%0A    if os.path.exists(file_name):%0A        os.remove(file_name)%0A    fac_file = open(file_name, 'w+')%0A    del data%5B0%5D%0A    dumped_data = %22%22%0A    try:%0A        dumped_data = json.dumps(data)%0A    except:%0A        print data%0A        raise%0A%0A    fac_file.write(dumped_data)%0A%0A%0Adef write_chuls_and_chews():%0A    chus, chews = create_chuls_file()%0A    write_file('chul.txt', chus)%0A    write_file('chew.txt', chews)%0A

Add script to read and load chus and chews