CREATE TABLE "update".occ_temp_parties (
	parcel_parties text,
	party_role text,
	relationship text,
	relationship_other text,
	tenure_acquisition text, 
	other_tenure_acquisition text,
	tenure_responsibilities text,
	other_responsibilities text,
	tenure_restrictions text,
	other_restrictions text,
	tenure_rights text,
	other_rights text,
	tenure_status text,
	witness_relationship text,
	other_witness text,
	prefix_name text,
	prefix_other text,
	given_name text,
	middle_name text,
	family_name text,
	suffix_name text,
	suffix_other text,
	gender text, 
	civil_status text,
	age text,
	birthdate date,
	year_of_birth text,
	age_range text,
	nationality text,
	other_nationality text,
	party_availability text,
	passport_photo text,
	id_availability text,
	id_type text,
	nrc_number text,
	passport_number text,
	driving_licence_number text,
	formal_id text, 
	formal_id_number text,
	id_photo_front text,
	id_photo_back text,
	address_type text,
	province text,
	chiefdom text,
	other_chiefdom text,
	p_vag text,
	p_vag_other text,
	searchtext text,
	village_id text,
	other_village text,
	address_Line_1 text,
	address_line_2 text,
	address_town_or_city text,
	address_urban_province text, 
	telephone_location_t1 text,
	telephone_main_za numeric, 
	telephone_main_za_02 numeric,
	telephone_location_t2 text,
	telephone_main_zb numeric,
	telephone_main_ib numeric,
	email text,
	anp_add_parties_parcel_details text,
	PARENT_KEY text,
	KEY text
);

copy "update".occ_temp_parties from '/home/ubuntu/fzs/form_f1_occ/OCC_v2-group_parties_physical.csv'
DELIMITER ','
CSV HEADER;

update update.occ_temp_parties
set chiefdom = 'Chikwa'
where chiefdom ='CHI';

update update.occ_temp_parties
set chiefdom = 'CIFUNDA'
where chiefdom ='CHF';

update update.occ_temp_parties
set province = 'Eastern'
where province ='ZM30';

DROP TABLE "update".occ_temp_parties


