From 06a4622f59179bc4e0c47f907ebddf2a17a889ef Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 28 Nov 2023 12:31:06 -0600 Subject: [PATCH] Convert data from the tidy to the easy schema --- conversion/Makefile | 24 +- conversion/clean_names.sql | 909 +++++++++++++++++++++++++++++++++++++ 2 files changed, 932 insertions(+), 1 deletion(-) create mode 100644 conversion/clean_names.sql diff --git a/conversion/Makefile b/conversion/Makefile index 1f09838..a68ce5e 100644 --- a/conversion/Makefile +++ b/conversion/Makefile @@ -74,6 +74,7 @@ PSQL_SETUP: $(GENERIC_DEPENDS) CONVERSION_SCHEMA := raw LIBCONV_SCHEMA = libconv TIDY_SCHEMA := tidy +EASY_SCHEMA := easy PSQL_RAW_SETUP := $(PSQL_SETUP) \ printf 'SET search_path TO $(CONVERSION_SCHEMA);\n' ; PSQL_LIBCONV_SETUP := $(PSQL_SETUP) \ @@ -81,6 +82,8 @@ PSQL_LIBCONV_SETUP := $(PSQL_SETUP) \ PSQL_TIDY_SETUP := $(PSQL_SETUP) \ printf 'SET search_path TO %s,%s;\n' \ $(TIDY_SCHEMA) $(LIBCONV_SCHEMA) ; +PSQL_EASY_SETUP := $(PSQL_SETUP) \ + printf 'SET search_path TO $(EASY_SCHEMA);\n' ; ## ## The available targets for make (make TARGET) are: @@ -90,7 +93,8 @@ PSQL_TIDY_SETUP := $(PSQL_SETUP) \ ## CONVERSION_SCHEMA and convert the data, storing ## the converted data in the TARGET_DB. .PHONY: convert -convert: create-schema restore grant_permissions copy_tidy make_tidy +convert: create-schema restore grant_permissions copy_tidy make_tidy \ + copy_easy make_easy ## clean Delete all user-generated files .PHONY: clean @@ -154,3 +158,21 @@ make_tidy: $(PSQL_DEPENDS) libconv PSQL_ARGS="$(PSQL_ARGS)" \ PSQL_SINGLE_TRANS="$(PSQL_SINGLE_TRANS)" \ ./make_tidy.sh + +## copy_easy Copy the tidy schema into the easy schema +.PHONY: copy_easy +copy_easy: $(PSQL_DEPENDS) + # Copy the tidy schema to the easy schema + PSQL_SETUP="$(PSQL_SETUP)" \ + PSQL_ARGS="$(PSQL_ARGS)" \ + PSQL_ARGS_MINIMAL="$(PSQL_ARGS_MINIMAL)" \ + PSQL_SINGLE_TRANS="$(PSQL_SINGLE_TRANS)" \ + ./copy_schema.sh tidy easy + +## make_easy Convert all the table names of the easy schema to +## lower case and remove all spaces, to keep us sane. +.PHONY: make_easy +make_easy: $(PSQL_DEPENDS) clean_names.sql + ( $(PSQL_EASY_SETUP) \ + cat clean_names.sql ; ) \ + | psql $(PSQL_ARGS) $(PSQL_SINGLE_TRANS) --set=ON_ERROR_STOP=y diff --git a/conversion/clean_names.sql b/conversion/clean_names.sql new file mode 100644 index 0000000..4dd2e41 --- /dev/null +++ b/conversion/clean_names.sql @@ -0,0 +1,909 @@ +-- Copyright (C) 2023 The Meme Factory, Inc. http://www.karlpinc.com/ +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Affero General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see . +-- +-- Karl O. Pinc + +ALTER TABLE "ADJ_TIME" RENAME TO ADJ_TIME; + +ALTER TABLE "AGGRESSION_EVENT" RENAME TO AGGRESSION_EVENT; +ALTER TABLE aggression_event + RENAME "AE_date" TO AE_date; +ALTER TABLE aggression_event + RENAME "AE_FOL_B_focal_id" TO AE_FOL_B_focal_id; +ALTER TABLE aggression_event + RENAME "AE_time" TO AE_time; +ALTER TABLE aggression_event + RENAME "AE_DECIDED_flag" TO AE_DECIDED_flag; +ALTER TABLE aggression_event + RENAME "AE_B_aggressor_id" TO AE_B_aggressor_id; +ALTER TABLE aggression_event + RENAME "AE_aggressor_behavior" TO AE_aggressor_behavior; +ALTER TABLE aggression_event + RENAME "AE_multiple_aggressor_flag" TO AE_multiple_aggressor_flag; +ALTER TABLE aggression_event + RENAME "AE_B_recipient_id" TO AE_B_recipient_id; +ALTER TABLE aggression_event + RENAME "AE_recipient_certainty_flag" TO AE_recipient_certainty_flag; +ALTER TABLE aggression_event + RENAME "AE_recipient_behavior" TO AE_recipient_behavior; +ALTER TABLE aggression_event + RENAME "AE_multiple_recipient_flag" TO AE_multiple_recipient_flag; +ALTER TABLE aggression_event + RENAME "AE_bad_observation_flag" TO AE_bad_observation_flag; +ALTER TABLE aggression_event + RENAME "AE_bristle_flag" TO AE_bristle_flag; +ALTER TABLE aggression_event + RENAME "AE_display_flag" TO AE_display_flag; +ALTER TABLE aggression_event + RENAME "AE_chase_flag" TO AE_chase_flag; +ALTER TABLE aggression_event + RENAME "AE_contact_flag" TO AE_contact_flag; +ALTER TABLE aggression_event + RENAME "AE_vocal_flag" TO AE_vocal_flag; +ALTER TABLE aggression_event + RENAME "AE_fight_category" TO AE_fight_category; +ALTER TABLE aggression_event + RENAME "AE_full_description" TO AE_full_description; +ALTER TABLE aggression_event + RENAME "AE_CL_community_id" TO AE_CL_community_id; +ALTER TABLE aggression_event + RENAME "AE_source" TO AE_source; +ALTER TABLE aggression_event + RENAME "AE_extracted_by" TO AE_extracted_by; +ALTER TABLE aggression_event + RENAME "AE_year" TO AE_year; +ALTER TABLE aggression_event + RENAME "DUP" TO DUP; + + +ALTER TABLE "AGGRESSION_EVENT_LOG" RENAME TO AGGRESSION_EVENT_LOG; +ALTER TABLE aggression_event_log + RENAME "YEAR" TO YEAR; +ALTER TABLE aggression_event_log + RENAME "COMMUNITY" TO COMMUNITY; +ALTER TABLE aggression_event_log + RENAME "B-REC ENGLISH" TO B_REC_ENGLISH; +ALTER TABLE aggression_event_log + RENAME "A-REC SWAHILI" TO A_REC_SWAHILI; +ALTER TABLE aggression_event_log + RENAME "A-REC ENGLISH NOTES" TO A_REC_ENGLISH_NOTES; +ALTER TABLE aggression_event_log + RENAME "A-REC BOOK EXTRACT" TO A_REC_BOOK_EXTRACT; +ALTER TABLE aggression_event_log + RENAME "B-REC SWAHILI" TO B_REC_SWAHILI; +ALTER TABLE aggression_event_log + RENAME "B-REC BOOK EXTRACT" TO B_REC_BOOK_EXTRACT; +ALTER TABLE aggression_event_log + RENAME "MA-INF BOOK EXTRACT" TO MA_INF_BOOK_EXTRACT; +ALTER TABLE aggression_event_log + RENAME "MA-INF" TO MA_INF; +ALTER TABLE aggression_event_log + RENAME "SCHROEPFER" TO SCHROEPFER; +ALTER TABLE aggression_event_log + RENAME "NOTES" TO NOTES; + + +ALTER TABLE "ATTENDANCE" RENAME TO ATTENDANCE; +ALTER TABLE attendance + RENAME "A_date" TO A_date; +ALTER TABLE attendance + RENAME "A_CL_community_ID" TO A_CL_community_ID; +ALTER TABLE attendance + RENAME "A_B_AnimID" TO A_B_AnimID; +ALTER TABLE attendance + RENAME "A_seq_num" TO A_seq_num; +ALTER TABLE attendance + RENAME "A_type_of_cycle" TO A_type_of_cycle; +ALTER TABLE attendance + RENAME "A_observer1_ID" TO A_observer1_ID; +ALTER TABLE attendance + RENAME "A_observer2_ID" TO A_observer2_ID; +ALTER TABLE attendance + RENAME "A_bananas_given" TO A_bananas_given; +ALTER TABLE attendance + RENAME "A_degree_of_arrival" TO A_degree_of_arrival; +ALTER TABLE attendance + RENAME "A_degree_of_departure" TO A_degree_of_departure; +ALTER TABLE attendance + RENAME "A_time_start" TO A_time_start; +ALTER TABLE attendance + RENAME "A_time_end" TO A_time_end; +ALTER TABLE attendance + RENAME "A_duration_of_obs" TO A_duration_of_obs; +ALTER TABLE attendance + RENAME "DAY" TO DAY; +ALTER TABLE attendance + RENAME "MO" TO MO; +ALTER TABLE attendance + RENAME "YR" TO YR; +ALTER TABLE attendance + RENAME "Cycle_OLD" TO Cycle_OLD; + + +ALTER TABLE "BIOGRAPHY" RENAME TO BIOGRAPHY; +ALTER TABLE biography + RENAME "B_AnimID" TO B_AnimID; +ALTER TABLE biography + RENAME "B_AnimID_num" TO B_AnimID_num; +ALTER TABLE biography + RENAME "B_AnimName" TO B_AnimName; +ALTER TABLE biography + RENAME "B_BirthGroup" TO B_BirthGroup; +ALTER TABLE biography + RENAME "B_BGCertainty" TO B_BGCertainty; +ALTER TABLE biography + RENAME "B_Sex" TO B_Sex; +ALTER TABLE biography + RENAME "B_MomID" TO B_MomID; +ALTER TABLE biography + RENAME "B_DadID" TO B_DadID; +ALTER TABLE biography + RENAME "B_DadID_publication_info" TO B_DadID_publication_info; +ALTER TABLE biography + RENAME "B_FirstBorn" TO B_FirstBorn; +ALTER TABLE biography + RENAME "B_Birthdate" TO B_Birthdate; +ALTER TABLE biography + RENAME "B_BDMin" TO B_BDMin; +ALTER TABLE biography + RENAME "B_BDMax" TO B_BDMax; +ALTER TABLE biography + RENAME "B_BDDist" TO B_BDDist; +ALTER TABLE biography + RENAME "B_Entrydate" TO B_Entrydate; +ALTER TABLE biography + RENAME "B_Entrytype" TO B_Entrytype; +ALTER TABLE biography + RENAME "B_Departdate" TO B_Departdate; +ALTER TABLE biography + RENAME "B_DepartdateError" TO B_DepartdateError; +ALTER TABLE biography + RENAME "B_Departtype" TO B_Departtype; + + +ALTER TABLE "BIOGRAPHY_UPDATE_LOG" RENAME TO BIOGRAPHY_UPDATE_LOG; + + +ALTER TABLE "BRECORD_NOTES" RENAME TO BRECORD_NOTES; +ALTER TABLE brecord_notes + RENAME "BREC_FOL_date" TO BREC_FOL_date; +ALTER TABLE brecord_notes + RENAME "BREC_FOL_B_focal_AnimID" TO BREC_FOL_B_focal_AnimID; +ALTER TABLE brecord_notes + RENAME "BREC_time" TO BREC_time; +ALTER TABLE brecord_notes + RENAME "BREC_observation" TO BREC_observation; +ALTER TABLE brecord_notes + RENAME "BREC_comments" TO BREC_comments; +ALTER TABLE brecord_notes + RENAME "BREC_observer" TO BREC_observer; +ALTER TABLE brecord_notes + RENAME "BREC_translator" TO BREC_translator; +ALTER TABLE brecord_notes + RENAME "BREC_transcribed_by" TO BREC_transcribed_by; +ALTER TABLE brecord_notes + RENAME "BREC_Voc" TO BREC_Voc; +ALTER TABLE brecord_notes + RENAME "BREC_VocID" TO BREC_VocID; +ALTER TABLE brecord_notes + RENAME "BREC_Grooming_AggressionFlag" TO BREC_Grooming_AggressionFlag; +ALTER TABLE brecord_notes + RENAME "BREC_updated_on" TO BREC_updated_on; +ALTER TABLE brecord_notes + RENAME "BREC_duplicate_flag" TO BREC_duplicate_flag; + + +ALTER TABLE "CHIMPS_ON_TIKIS_LOOKUP" RENAME TO CHIMPS_ON_TIKIS_LOOKUP; +ALTER TABLE chimps_on_tikis_lookup + RENAME "B_AnimID" TO B_AnimID; + +ALTER TABLE "COLOBUS" RENAME TO COLOBUS; +ALTER TABLE colobus + RENAME "COL_encounter_date" TO COL_encounter_date; +ALTER TABLE colobus + RENAME "COL_FOL_B_focal_chimp_id" TO COL_FOL_B_focal_chimp_id; +ALTER TABLE colobus + RENAME "COL_begin_time" TO COL_begin_time; +ALTER TABLE colobus + RENAME "COL_begin_time_map" TO COL_begin_time_map; +ALTER TABLE colobus + RENAME "COL_end_time" TO COL_end_time; +ALTER TABLE colobus + RENAME "COL_hunt_flag" TO COL_hunt_flag; +ALTER TABLE colobus + RENAME "COL_hunter_id" TO COL_hunter_id; +ALTER TABLE colobus + RENAME "COL_hunt_cert" TO COL_hunt_cert; +ALTER TABLE colobus + RENAME "COL_male_hunt_flag" TO COL_male_hunt_flag; +ALTER TABLE colobus + RENAME "COL_fem_hunt_flag" TO COL_fem_hunt_flag; +ALTER TABLE colobus + RENAME "COLfocal_hunt_flag" TO COLfocal_hunt_flag; +ALTER TABLE colobus + RENAME "COL_focal_hunt_cert" TO COL_focal_hunt_cert; +ALTER TABLE colobus + RENAME "COL_kill_flag" TO COL_kill_flag; +ALTER TABLE colobus + RENAME "COL_killer_id" TO COL_killer_id; +ALTER TABLE colobus + RENAME "COL_num_kills_total" TO COL_num_kills_total; +ALTER TABLE colobus + RENAME "COL_num_kills_by_males" TO COL_num_kills_by_males; +ALTER TABLE colobus + RENAME "COL_num_kills_by_focal_male" TO COL_num_kills_by_focal_male; +ALTER TABLE colobus + RENAME "COL_num_kills_by_focal_female" TO COL_num_kills_by_focal_female; +ALTER TABLE colobus + RENAME "COL_victim_age" TO COL_victim_age; +ALTER TABLE colobus + RENAME "COL_num_infants_killed" TO COL_num_infants_killed; +ALTER TABLE colobus + RENAME "COL_num_juv_killed" TO COL_num_juv_killed; +ALTER TABLE colobus + RENAME "COL_num_adults_killed" TO COL_num_adults_killed; +ALTER TABLE colobus + RENAME "COL_num_unknown_age_killed" TO COL_num_unknown_age_killed; +ALTER TABLE colobus + RENAME "COL_colobus_group size" TO COL_colobus_group_size; +ALTER TABLE colobus + RENAME "COL_colobus_details" TO COL_colobus_details; + + +ALTER TABLE "COMMUNITY_LOOKUP" RENAME TO COMMUNITY_LOOKUP; +ALTER TABLE community_lookup + RENAME "CL_community_id" TO CL_community_id; +ALTER TABLE community_lookup + RENAME "CL_community_name" TO CL_community_name; +ALTER TABLE community_lookup + RENAME "CL_details" TO CL_details; + + +ALTER TABLE "COMMUNITY_MEMBERSHIP" RENAME TO COMMUNITY_MEMBERSHIP; +ALTER TABLE community_membership + RENAME "CM_B_AnimId" TO CM_B_AnimId; +ALTER TABLE community_membership + RENAME "CM_start_date" TO CM_start_date; +ALTER TABLE community_membership + RENAME "CM_end_date" TO CM_end_date; +ALTER TABLE community_membership + RENAME "CM_CL_community_id" TO CM_CL_community_id; +ALTER TABLE community_membership + RENAME "CM_start_source" TO CM_start_source; +ALTER TABLE community_membership + RENAME "CM_end_source" TO CM_end_source; + + + +ALTER TABLE "COMMUNITY_MEMBERSHIP_UPDATE_LOG" RENAME TO COMMUNITY_MEMBERSHIP_UPDATE_LOG; +ALTER TABLE community_membership_update_log + RENAME "made by" TO made_by; + + +ALTER TABLE "ELO RANKS DAILY - FEMALES - old" RENAME TO ELO_RANKS_DAILY___FEMALES___old; +ALTER TABLE elo_ranks_daily___females___old + RENAME "Date" TO Date; +ALTER TABLE elo_ranks_daily___females___old + RENAME "Female" TO Female; +ALTER TABLE elo_ranks_daily___females___old + RENAME "EloStartingValue" TO EloStartingValue; +ALTER TABLE elo_ranks_daily___females___old + RENAME "Elo" TO Elo; +ALTER TABLE elo_ranks_daily___females___old + RENAME "Elo_mean" TO Elo_mean; +ALTER TABLE elo_ranks_daily___females___old + RENAME "Elo_sd" TO Elo_sd; +ALTER TABLE elo_ranks_daily___females___old + RENAME "Pre" TO Pre; +ALTER TABLE elo_ranks_daily___females___old + RENAME "EntryType" TO EntryType; +ALTER TABLE elo_ranks_daily___females___old + RENAME "MomPresence" TO MomPresence; +ALTER TABLE elo_ranks_daily___females___old + RENAME "EntryMom" TO EntryMom; +ALTER TABLE elo_ranks_daily___females___old + RENAME "EloOrdinal" TO EloOrdinal; +ALTER TABLE elo_ranks_daily___females___old + RENAME "EloOrdinal_max" TO EloOrdinal_max; +ALTER TABLE elo_ranks_daily___females___old + RENAME "PropDominated" TO PropDominated; +ALTER TABLE elo_ranks_daily___females___old + RENAME "PropDominatedThirds" TO PropDominatedThirds; +ALTER TABLE elo_ranks_daily___females___old + RENAME "NaturalCatsJenks3" TO NaturalCatsJenks3; +ALTER TABLE elo_ranks_daily___females___old + RENAME "CardinalRanksMathias" TO CardinalRanksMathias; + + + +ALTER TABLE "ELO RANKS DAILY - KK FEMALES" RENAME TO ELO_RANKS_DAILY___KK_FEMALES; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "Date" TO Date; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "Individual" TO Individual; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "Elo" TO Elo; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "EloOrdinal" TO EloOrdinal; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "EloScaled" TO EloScaled; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "ExpNumBeaten" TO ExpNumBeaten; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "EloCardinal" TO EloCardinal; +ALTER TABLE elo_ranks_daily___kk_females + RENAME "JenksEloCardinal" TO JenksEloCardinal; + + +ALTER TABLE "ELO RANKS DAILY - KK MALES" RENAME TO ELO_RANKS_DAILY___KK_MALES; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "Date" TO Date; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "Individual" TO Individual; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "Elo" TO Elo; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "EloOrdinal" TO EloOrdinal; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "EloScaled" TO EloScaled; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "ExpNumBeaten" TO ExpNumBeaten; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "EloCardinal" TO EloCardinal; +ALTER TABLE elo_ranks_daily___kk_males + RENAME "JenksEloCardinal" TO JenksEloCardinal; + + +ALTER TABLE "ELO RANKS DAILY - MALES - old" RENAME TO ELO_RANKS_DAILY___MALES___old; +ALTER TABLE elo_ranks_daily___males___old + RENAME "Date" TO Date; +ALTER TABLE elo_ranks_daily___males___old + RENAME "Individual" TO Individual; +ALTER TABLE elo_ranks_daily___males___old + RENAME "Elo" TO Elo; +ALTER TABLE elo_ranks_daily___males___old + RENAME "EloOrdinal" TO EloOrdinal; +ALTER TABLE elo_ranks_daily___males___old + RENAME "EloScaled" TO EloScaled; +ALTER TABLE elo_ranks_daily___males___old + RENAME "EloCardinal" TO EloCardinal; +ALTER TABLE elo_ranks_daily___males___old + RENAME "JenksEloCardinal" TO JenksEloCardinal; + + +ALTER TABLE "ELO RANKS DAILY - MT FEMALES" RENAME TO ELO_RANKS_DAILY___MT_FEMALES; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "Date" TO Date; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "Individual" TO Individual; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "Elo" TO Elo; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "EloOrdinal" TO EloOrdinal; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "EloScaled" TO EloScaled; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "ExpNumBeaten" TO ExpNumBeaten; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "EloCardinal" TO EloCardinal; +ALTER TABLE elo_ranks_daily___mt_females + RENAME "JenksEloCardinal" TO JenksEloCardinal; + + +ALTER TABLE "FEMALE REPRODUCTIVE STATES" RENAME TO FEMALE_REPRODUCTIVE_STATES; + + +ALTER TABLE "FEMALE_REPRO_HISTORY" RENAME TO FEMALE_REPRO_HISTORY; +ALTER TABLE female_repro_history + RENAME "B_AnimID" TO B_AnimID; +ALTER TABLE female_repro_history + RENAME "DATE" TO DATE; +ALTER TABLE female_repro_history + RENAME "youngest_kid_ID" TO youngest_kid_ID; +ALTER TABLE female_repro_history + RENAME "ESTROUS_MIN" TO ESTROUS_MIN; +ALTER TABLE female_repro_history + RENAME "ESTROUS_MAX" TO ESTROUS_MAX; + + +ALTER TABLE "FERTILITY" RENAME TO FERTILITY; +ALTER TABLE fertility + RENAME "StudyId" TO StudyId; +ALTER TABLE fertility + RENAME "AnimalId" TO AnimalId; +ALTER TABLE fertility + RENAME "StartDate" TO StartDate; +ALTER TABLE fertility + RENAME "StartType" TO StartType; +ALTER TABLE fertility + RENAME "StopDate" TO StopDate; +ALTER TABLE fertility + RENAME "StopType" TO StopType; + + +ALTER TABLE "FOLLOW" RENAME TO FOLLOW; +ALTER TABLE follow + RENAME "FOL_date" TO FOL_date; +ALTER TABLE follow + RENAME "FOL_B_AnimID" TO FOL_B_AnimID; +ALTER TABLE follow + RENAME "FOL_CL_community_id" TO FOL_CL_community_id; +ALTER TABLE follow + RENAME "FOL_time_begin" TO FOL_time_begin; +ALTER TABLE follow + RENAME "FOL_time_end" TO FOL_time_end; +ALTER TABLE follow + RENAME "FOL_flag_begin_in_nest" TO FOL_flag_begin_in_nest; +ALTER TABLE follow + RENAME "FOL_flag_end_in_nest" TO FOL_flag_end_in_nest; +ALTER TABLE follow + RENAME "FOL_duration" TO FOL_duration; +ALTER TABLE follow + RENAME "FOL_distance_traveled" TO FOL_distance_traveled; +ALTER TABLE follow + RENAME "FOL_am_observer_1" TO FOL_am_observer_1; +ALTER TABLE follow + RENAME "FOL_am_observer_2" TO FOL_am_observer_2; +ALTER TABLE follow + RENAME "FOL_pm_observer_1" TO FOL_pm_observer_1; +ALTER TABLE follow + RENAME "FOL_pm_observer_2" TO FOL_pm_observer_2; +ALTER TABLE follow + RENAME "FOL_study_code_1" TO FOL_study_code_1; +ALTER TABLE follow + RENAME "FOL_study_code_2" TO FOL_study_code_2; +ALTER TABLE follow + RENAME "FOL_day" TO FOL_day; +ALTER TABLE follow + RENAME "FOL_month" TO FOL_month; +ALTER TABLE follow + RENAME "FOL_year" TO FOL_year; +ALTER TABLE follow + RENAME "FMP_OK" TO FMP_OK; +ALTER TABLE follow + RENAME "Update" TO Update; + + +ALTER TABLE "FOLLOW_ARRIVAL" RENAME TO FOLLOW_ARRIVAL; +ALTER TABLE follow_arrival + RENAME "FA_FOL_date" TO FA_FOL_date; +ALTER TABLE follow_arrival + RENAME "FA_FOL_B_focal_AnimID" TO FA_FOL_B_focal_AnimID; +ALTER TABLE follow_arrival + RENAME "FA_B_arr_AnimID" TO FA_B_arr_AnimID; +ALTER TABLE follow_arrival + RENAME "FA_seq_num" TO FA_seq_num; +ALTER TABLE follow_arrival + RENAME "FA_type_of_certainty" TO FA_type_of_certainty; +ALTER TABLE follow_arrival + RENAME "FA_type_of_nesting" TO FA_type_of_nesting; +ALTER TABLE follow_arrival + RENAME "FA_type_of_cycle" TO FA_type_of_cycle; +ALTER TABLE follow_arrival + RENAME "FA_time_start" TO FA_time_start; +ALTER TABLE follow_arrival + RENAME "FA_time_end" TO FA_time_end; +ALTER TABLE follow_arrival + RENAME "FA_duration_of_obs" TO FA_duration_of_obs; +ALTER TABLE follow_arrival + RENAME "FA_update" TO FA_update; +ALTER TABLE follow_arrival + RENAME "FA_data_source" TO FA_data_source; + + +ALTER TABLE "FOLLOW_MAP_LOCATION" RENAME TO FOLLOW_MAP_LOCATION; +ALTER TABLE follow_map_location + RENAME "FML_FOL_date" TO FML_FOL_date; +ALTER TABLE follow_map_location + RENAME "FML_FOL_B_focal_AnimID" TO FML_FOL_B_focal_AnimID; +ALTER TABLE follow_map_location + RENAME "FML_time" TO FML_time; +ALTER TABLE follow_map_location + RENAME "FML_FMP_seq_num" TO FML_FMP_seq_num; +ALTER TABLE follow_map_location + RENAME "FML_x_coord" TO FML_x_coord; +ALTER TABLE follow_map_location + RENAME "FML_y_coord" TO FML_y_coord; +ALTER TABLE follow_map_location + RENAME "FML_meters_to_next_seq_num" TO FML_meters_to_next_seq_num; +ALTER TABLE follow_map_location + RENAME "FML_community_id" TO FML_community_id; +ALTER TABLE follow_map_location + RENAME "FML_FOL_foll_num" TO FML_FOL_foll_num; +ALTER TABLE follow_map_location + RENAME "FML_elevation" TO FML_elevation; +ALTER TABLE follow_map_location + RENAME "FML_origin" TO FML_origin; +ALTER TABLE follow_map_location + RENAME "FML_notes" TO FML_notes; +ALTER TABLE follow_map_location + RENAME "FML_entered" TO FML_entered; +ALTER TABLE follow_map_location + RENAME "FML_update" TO FML_update; + + +ALTER TABLE "FOLLOW_MAP_POSITION" RENAME TO FOLLOW_MAP_POSITION; +ALTER TABLE follow_map_position + RENAME "FMP_FOL_date" TO FMP_FOL_date; +ALTER TABLE follow_map_position + RENAME "FMP_FOL_B_focal_AnimID" TO FMP_FOL_B_focal_AnimID; +ALTER TABLE follow_map_position + RENAME "FMP_seq_num" TO FMP_seq_num; +ALTER TABLE follow_map_position + RENAME "FMP_x_coord" TO FMP_x_coord; +ALTER TABLE follow_map_position + RENAME "FMP_y_coord" TO FMP_y_coord; +ALTER TABLE follow_map_position + RENAME "FMP_meters_to_next_seq_num" TO FMP_meters_to_next_seq_num; +ALTER TABLE follow_map_position + RENAME "FMP_community_id" TO FMP_community_id; +ALTER TABLE follow_map_position + RENAME "FMP_FOL_foll_num" TO FMP_FOL_foll_num; +ALTER TABLE follow_map_position + RENAME "FMP_x_coord_old" TO FMP_x_coord_old; +ALTER TABLE follow_map_position + RENAME "FMP_y_coord_old" TO FMP_y_coord_old; +ALTER TABLE follow_map_position + RENAME "CORRESPONDING_FOLLOW" TO CORRESPONDING_FOLLOW; +ALTER TABLE follow_map_position + RENAME "CORRESPONDING_FOLLOW_MAP_TIME" TO CORRESPONDING_FOLLOW_MAP_TIME; + + +ALTER TABLE "FOLLOW_MAP_TIME" RENAME TO FOLLOW_MAP_TIME; +ALTER TABLE follow_map_time + RENAME "FMT_FOL_date" TO FMT_FOL_date; +ALTER TABLE follow_map_time + RENAME "FMT_FOL_B_focal_AnimID" TO FMT_FOL_B_focal_AnimID; +ALTER TABLE follow_map_time + RENAME "FMT_time" TO FMT_time; +ALTER TABLE follow_map_time + RENAME "FMT_FMP_seq_num" TO FMT_FMP_seq_num; +ALTER TABLE follow_map_time + RENAME "FMT_update" TO FMT_update; + + +ALTER TABLE "FOLLOW_MAP_TIME_PROBLEMS" RENAME TO FOLLOW_MAP_TIME_PROBLEMS; +ALTER TABLE follow_map_time_problems + RENAME "FMTP_Date" TO FMTP_Date; + + +ALTER TABLE "FOOD_BOUT" RENAME TO FOOD_BOUT; +ALTER TABLE food_bout + RENAME "FB_FOL_date" TO FB_FOL_date; +ALTER TABLE food_bout + RENAME "FB_FOL_B_focal_AnimID" TO FB_FOL_B_focal_AnimID; +ALTER TABLE food_bout + RENAME "FB_begin_feed_time" TO FB_begin_feed_time; +ALTER TABLE food_bout + RENAME "FB_end_feed_time" TO FB_end_feed_time; +ALTER TABLE food_bout + RENAME "FB_duration" TO FB_duration; +ALTER TABLE food_bout + RENAME "FB_FPL_local_food_part" TO FB_FPL_local_food_part; +ALTER TABLE food_bout + RENAME "FB_FL_local_food_name" TO FB_FL_local_food_name; +ALTER TABLE food_bout + RENAME "FB_FPL_local_food_part2" TO FB_FPL_local_food_part2; +ALTER TABLE food_bout + RENAME "FB_local_food_name2" TO FB_local_food_name2; +ALTER TABLE food_bout + RENAME "FB_local_food_part_written" TO FB_local_food_part_written; +ALTER TABLE food_bout + RENAME "FB_local_food_name_written" TO FB_local_food_name_written; +ALTER TABLE food_bout + RENAME "FB_update" TO FB_update; + + +ALTER TABLE "FOOD_LOOKUP" RENAME TO FOOD_LOOKUP; +ALTER TABLE food_lookup + RENAME "FL_local_food_name" TO FL_local_food_name; +ALTER TABLE food_lookup + RENAME "FL_sci_food_name" TO FL_sci_food_name; +ALTER TABLE food_lookup + RENAME "FL_sci_food_name_gen" TO FL_sci_food_name_gen; +ALTER TABLE food_lookup + RENAME "FL_exclude" TO FL_exclude; +ALTER TABLE food_lookup + RENAME "FL_notes" TO FL_notes; + + +ALTER TABLE "FOOD_PART_LOOKUP" RENAME TO FOOD_PART_LOOKUP; +ALTER TABLE food_part_lookup + RENAME "FPL_local_food_part" TO FPL_local_food_part; +ALTER TABLE food_part_lookup + RENAME "FPL_food_part_initials" TO FPL_food_part_initials; +ALTER TABLE food_part_lookup + RENAME "FPL_english_food_part" TO FPL_english_food_part; + + +ALTER TABLE "FOOD_VARIATIONS_LOOKUP" RENAME TO FOOD_VARIATIONS_LOOKUP; +ALTER TABLE food_variations_lookup + RENAME "FVL_food_spelling_variant" TO FVL_food_spelling_variant; +ALTER TABLE food_variations_lookup + RENAME "FVL_FL_local_food_name" TO FVL_FL_local_food_name; + + +ALTER TABLE "GROOM_BOUT" RENAME TO GROOM_BOUT; +ALTER TABLE groom_bout + RENAME "GRM_FOL_date" TO GRM_FOL_date; +ALTER TABLE groom_bout + RENAME "GRM_FOL_B_focal_AnimId" TO GRM_FOL_B_focal_AnimId; +ALTER TABLE groom_bout + RENAME "GRM_time_begin" TO GRM_time_begin; +ALTER TABLE groom_bout + RENAME "GRM_B_partner_AnimId" TO GRM_B_partner_AnimId; +ALTER TABLE groom_bout + RENAME "GRM_time_end" TO GRM_time_end; +ALTER TABLE groom_bout + RENAME "GRM_dur" TO GRM_dur; +ALTER TABLE groom_bout + RENAME "GRM_direction" TO GRM_direction; +ALTER TABLE groom_bout + RENAME "GRM_time_certainty" TO GRM_time_certainty; +ALTER TABLE groom_bout + RENAME "GRM_other_partners" TO GRM_other_partners; +ALTER TABLE groom_bout + RENAME "GRM_B_initiator_AnimId" TO GRM_B_initiator_AnimId; +ALTER TABLE groom_bout + RENAME "GRM_B_terminator_AnimId" TO GRM_B_terminator_AnimId; +ALTER TABLE groom_bout + RENAME "GRM_comments" TO GRM_comments; +ALTER TABLE groom_bout + RENAME "GRM_extracted_by" TO GRM_extracted_by; +ALTER TABLE groom_bout + RENAME "GRM_PROBLEMS" TO GRM_PROBLEMS; +ALTER TABLE groom_bout + RENAME "DATE_UPDATED" TO DATE_UPDATED; + + +ALTER TABLE "GROOM_SCAN_AREC" RENAME TO GROOM_SCAN_AREC; +ALTER TABLE groom_scan_arec + RENAME "Date" TO Date; +ALTER TABLE groom_scan_arec + RENAME "TIME" TO TIME; +ALTER TABLE groom_scan_arec + RENAME "Chimp_1" TO Chimp_1; +ALTER TABLE groom_scan_arec + RENAME "Chimp_2" TO Chimp_2; +ALTER TABLE groom_scan_arec + RENAME "Direction" TO Direction; + + +ALTER TABLE "GROOM_SCANS" RENAME TO GROOM_SCANS; +ALTER TABLE groom_scans + RENAME "GS_date" TO GS_date; +ALTER TABLE groom_scans + RENAME "GS_FOL_B_focal_AnimID" TO GS_FOL_B_focal_AnimID; +ALTER TABLE groom_scans + RENAME "GS_time" TO GS_time; +ALTER TABLE groom_scans + RENAME "GS_B_chimp1_AnimID" TO GS_B_chimp1_AnimID; +ALTER TABLE groom_scans + RENAME "GS_B_chimp2_AnimID" TO GS_B_chimp2_AnimID; +ALTER TABLE groom_scans + RENAME "GS_direction" TO GS_direction; +ALTER TABLE groom_scans + RENAME "GS_focal_involved_flag" TO GS_focal_involved_flag; +ALTER TABLE groom_scans + RENAME "GS_other_partners_flag" TO GS_other_partners_flag; +ALTER TABLE groom_scans + RENAME "GS_duplicate_flag" TO GS_duplicate_flag; +ALTER TABLE groom_scans + RENAME "GS_comments" TO GS_comments; +ALTER TABLE groom_scans + RENAME "GS_extracted_by" TO GS_extracted_by; + + +ALTER TABLE "GROUP_COMP_INPUT" RENAME TO GROUP_COMP_INPUT; +ALTER TABLE group_comp_input + RENAME "EVENT_ID" TO EVENT_ID; +ALTER TABLE group_comp_input + RENAME "DATE" TO DATE; +ALTER TABLE group_comp_input + RENAME "FOCAL" TO FOCAL; +ALTER TABLE group_comp_input + RENAME "TIME" TO TIME; + + +ALTER TABLE "MATING_EVENT" RENAME TO MATING_EVENT; +ALTER TABLE mating_event + RENAME "M_FOL_date" TO M_FOL_date; +ALTER TABLE mating_event + RENAME "M_FOL_B_focal_AnimId" TO M_FOL_B_focal_AnimId; +ALTER TABLE mating_event + RENAME "M_time" TO M_time; +ALTER TABLE mating_event + RENAME "M_male" TO M_male; +ALTER TABLE mating_event + RENAME "M_female" TO M_female; +ALTER TABLE mating_event + RENAME "M_fem_swelling" TO M_fem_swelling; +ALTER TABLE mating_event + RENAME "M_full_description" TO M_full_description; +ALTER TABLE mating_event + RENAME "M_comments" TO M_comments; +ALTER TABLE mating_event + RENAME "M_fail_flag" TO M_fail_flag; +ALTER TABLE mating_event + RENAME "M_interference" TO M_interference; +ALTER TABLE mating_event + RENAME "M_incest_flag" TO M_incest_flag; +ALTER TABLE mating_event + RENAME "M_interference_too_late_flag" TO M_interference_too_late_flag; +ALTER TABLE mating_event + RENAME "M_consort_flag" TO M_consort_flag; +ALTER TABLE mating_event + RENAME "M_mate_guard_flag" TO M_mate_guard_flag; +ALTER TABLE mating_event + RENAME "M_source" TO M_source; +ALTER TABLE mating_event + RENAME "M_year" TO M_year; +ALTER TABLE mating_event + RENAME "M_court_flag" TO M_court_flag; +ALTER TABLE mating_event + RENAME "M_camp_flag" TO M_camp_flag; +ALTER TABLE mating_event + RENAME "M_CL_community_id" TO M_CL_community_id; +ALTER TABLE mating_event + RENAME "M_extracted_by" TO M_extracted_by; + + +ALTER TABLE "OTHER_SPECIES" RENAME TO OTHER_SPECIES; +ALTER TABLE other_species + RENAME "OS_FOL_date" TO OS_FOL_date; +ALTER TABLE other_species + RENAME "OS_FOL_B_focal_AnimID" TO OS_FOL_B_focal_AnimID; +ALTER TABLE other_species + RENAME "OS_time_begin" TO OS_time_begin; +ALTER TABLE other_species + RENAME "OS_time_end" TO OS_time_end; +ALTER TABLE other_species + RENAME "OS_OSL_local_species_name" TO OS_OSL_local_species_name; +ALTER TABLE other_species + RENAME "OS_local_species_name_written" TO OS_local_species_name_written; +ALTER TABLE other_species + RENAME "OS_duration" TO OS_duration; +ALTER TABLE other_species + RENAME "OS_comments" TO OS_comments; +ALTER TABLE other_species + RENAME "OS_update" TO OS_update; + + +ALTER TABLE "OTHER_SPECIES_LOOKUP" RENAME TO OTHER_SPECIES_LOOKUP; +ALTER TABLE other_species_lookup + RENAME "OSL_local_species_name" TO OSL_local_species_name; +ALTER TABLE other_species_lookup + RENAME "OSL_english_species_name" TO OSL_english_species_name; + + +ALTER TABLE "PANTGRUNT_EVENT" RENAME TO PANTGRUNT_EVENT; +ALTER TABLE pantgrunt_event + RENAME "pg_YEAR" TO pg_YEAR; + + +ALTER TABLE "PANTGRUNT_EVENT_LOG" RENAME TO PANTGRUNT_EVENT_LOG; +ALTER TABLE pantgrunt_event_log + RENAME "YEAR" TO YEAR; +ALTER TABLE pantgrunt_event_log + RENAME "A-REC SWAHILI" TO A_REC_SWAHILI; +ALTER TABLE pantgrunt_event_log + RENAME "A-REC ENGLISH NOTES" TO A_REC_ENGLISH_NOTES; +ALTER TABLE pantgrunt_event_log + RENAME "A-REC ASR" TO A_REC_ASR; +ALTER TABLE pantgrunt_event_log + RENAME "B-REC ENGLISH" TO B_REC_ENGLISH; +ALTER TABLE pantgrunt_event_log + RENAME "B-REC ASR EXTRACTIONS" TO B_REC_ASR_EXTRACTIONS; +ALTER TABLE pantgrunt_event_log + RENAME "MA-INF ASR EXTRACTIONS" TO MA_INF_ASR_EXTRACTIONS; +ALTER TABLE pantgrunt_event_log + RENAME "MA-INF" TO MA_INF; +ALTER TABLE pantgrunt_event_log + RENAME "ADOLESCENT STUDY TALLIES (PUSEY)" TO ADOLESCENT_STUDY_TALLIES_PUSEY; +ALTER TABLE pantgrunt_event_log + RENAME "GREENGRASS" TO GREENGRASS; +ALTER TABLE pantgrunt_event_log + RENAME "MURRAY" TO MURRAY; +ALTER TABLE pantgrunt_event_log + RENAME "O'MALLEY" TO O_MALLEY; +ALTER TABLE pantgrunt_event_log + RENAME "HEINTZ" TO HEINTZ; +ALTER TABLE pantgrunt_event_log + RENAME "O'BRYAN" TO O_BRYAN; +ALTER TABLE pantgrunt_event_log + RENAME "SCHROEPFER" TO SCHROEPFER; +ALTER TABLE pantgrunt_event_log + RENAME "NOTES" TO NOTES; + + +ALTER TABLE "SIGHTINGS" RENAME TO SIGHTINGS; +ALTER TABLE sightings + RENAME "S_date" TO S_date; +ALTER TABLE sightings + RENAME "S_B_AnimID" TO S_B_AnimID; +ALTER TABLE sightings + RENAME "S_CL_community_id" TO S_CL_community_id; +ALTER TABLE sightings + RENAME "S_estrous_min" TO S_estrous_min; +ALTER TABLE sightings + RENAME "S_estrous_max" TO S_estrous_max; +ALTER TABLE sightings + RENAME "S_estrous_discrepancy_flag" TO S_estrous_discrepancy_flag; +ALTER TABLE sightings + RENAME "S_min_estrous_BREC" TO S_min_estrous_BREC; +ALTER TABLE sightings + RENAME "S_max_estrous_BREC" TO S_max_estrous_BREC; +ALTER TABLE sightings + RENAME "S_min_estrous_AREC" TO S_min_estrous_AREC; +ALTER TABLE sightings + RENAME "S_max_estrous_AREC" TO S_max_estrous_AREC; +ALTER TABLE sightings + RENAME "Source" TO Source; +ALTER TABLE sightings + RENAME "S_estrous_REPORTS" TO S_estrous_REPORTS; + + +ALTER TABLE "SIV_STATUS_BOUT" RENAME TO SIV_STATUS_BOUT; +ALTER TABLE siv_status_bout + RENAME "SSB_B_AnimID" TO SSB_B_AnimID; +ALTER TABLE siv_status_bout + RENAME "SSB_start_date" TO SSB_start_date; +ALTER TABLE siv_status_bout + RENAME "SSB_end_date" TO SSB_end_date; +ALTER TABLE siv_status_bout + RENAME "SSB_SIV_status" TO SSB_SIV_status; +ALTER TABLE siv_status_bout + RENAME "SSB_first_test_date" TO SSB_first_test_date; +ALTER TABLE siv_status_bout + RENAME "SSB_last_test_date" TO SSB_last_test_date; +ALTER TABLE siv_status_bout + RENAME "SSB_bout_number" TO SSB_bout_number; +ALTER TABLE siv_status_bout + RENAME "SSB_names_used" TO SSB_names_used; +ALTER TABLE siv_status_bout + RENAME "SSB_in_bio_table" TO SSB_in_bio_table; +ALTER TABLE siv_status_bout + RENAME "SSB_notes" TO SSB_notes; + + +ALTER TABLE "SUBADULT_ARRIVALS_LOG" RENAME TO SUBADULT_ARRIVALS_LOG; +ALTER TABLE subadult_arrivals_log + RENAME "SA_B_AnimID" TO SA_B_AnimID; +ALTER TABLE subadult_arrivals_log + RENAME "SA_first_tiki_date" TO SA_first_tiki_date; +ALTER TABLE subadult_arrivals_log + RENAME "SA_notes" TO SA_notes; + + +ALTER TABLE "tbl_adjusted ages for alone arrivals" RENAME TO tbl_adjusted_ages_for_alone_arrivals; +ALTER TABLE tbl_adjusted_ages_for_alone_arrivals + RENAME "B_AnimID" TO B_AnimID; +ALTER TABLE tbl_adjusted_ages_for_alone_arrivals + RENAME "S_Date" TO S_Date; +ALTER TABLE tbl_adjusted_ages_for_alone_arrivals + RENAME "Year" TO Year; +ALTER TABLE tbl_adjusted_ages_for_alone_arrivals + RENAME "AgeCalc" TO AgeCalc; +ALTER TABLE tbl_adjusted_ages_for_alone_arrivals + RENAME "AgeAdj" TO AgeAdj; + + +-- There is also "tlk_brecord_notes_codes", which does not need renaming. +ALTER TABLE tlk_brecord_notes_codes + RENAME "ID" TO ID; +ALTER TABLE tlk_brecord_notes_codes + RENAME "Abbreviation" TO Abbreviation; +ALTER TABLE tlk_brecord_notes_codes + RENAME "Meaning" TO Meaning; -- 2.34.1