# Copyright (C) 2012, 2013-2015 The Meme Factory, Inc. http://www.meme.com>/
#
# This file is part of GombeMI.
#
# GombeMI is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GombeMI. If not, see .
#
# Regression test configuration
#
# Karl O. Pinc
#
# What it will do:
# o Test anything you can write in SQL which requires only
# one database connection and produces repeatable output,
# repeatable with respect to an initial db state.
# o Filter sql output to remove unrepeatable components.
# o Eliminate redundancy in SQL files due to complex
# foreign key relationships and other integrity
# constraints and automate dependency resolution by
# sharing SQL files among multiple tests, and, given
# immediate prerequisites, figure out for itself which SQL
# files need to be invoked and the order in which to
# invoke them.
# o Account for tests which require transactions when
# resolving dependencies.
#
# What it won't do:
# o Any sort of test requiring multiple db connections, including
# deadlock testing etc.
# o Run concurrently within a single directory.
# o Allow spaces in the a test's (file) name.
#
# Tests designed to fail, run within transactions,
# must fail as the last thing they do. (*duh*)
#
# The reset SQL file is run before each test is started,
# when all tests are finished, and when the 'reset' target
# is supplied. It is not run after individual tests are run,
# shown, or saved. This file should empty
# the database and otherwise re-set it for the next test run.
# (Don't forget to reset the sequences with setval().)
# You use this to define the initial db state.
#
# Design notes:
# If you want
# multiple transactions then have your SQL issue it's own
# COMMITs and BEGINs to turn transactions off and on as
# desired.
#
# The following test names are reserved:
# 'begin' Must be used to begin a transaction.
# 'commit' Must be used to commit a transaction.
#
# To use:
#
# make test Runs entire test suite
# make test_ Runs test
# make show_ Display output of
# make save_ Flags output of as successful
#
# To create a new test:
#
# * Write SQL script in test/sql/testname. This will usually involve
# inserting data.
# * Note dependencies below in prereq_testname. These are other files in
# test/sql/ that insert the data required to insert your new data.
# * To run the test within a transaction add the test to
# TRANSACTION_TESTS.
# * cd test; make GOMBEMI_DB=gobmemi_copy show_testname
# Make sure that the output is correct, then:
# * cd test; make GOMBEMI_DB=gombemi_copy save_testname
# This saves the output as correct output.
# * Add testname to TESTS, in correct place in order.
#
# If a test produces unrepeatable output:
# * Add a filter in the filters/ directory. This is an
# executable program. The file name should be the name of
# the test. (It may be a symlink.) The purpose of the
# filter program is to strip unrepeatable output from the
# sql results. The program takes one argument, the name
# of the test. It takes the result executing the test's
# sql on stdin. It's stdout is used as test output. If
# it returns a non-zero result code then the test exits
# with that result code and any output sent to stderr by
# the filter is used in the failure report. The program
# runs in the test directory. "dbgress filter" is a sample
# filter.
#
#
# When a test fails:
#
# * cd test; make GOMBEMI_DB=gombemi_copy show_testname
# Fix test/sql/testname, then, if necessary:
# * cd test; make GOMBEMI_DB=gombemi_copy save_testname
# This saves the output as correct output.
#
# Postgres user used to run the tests.
#ADMINUSER := kop
# List of tests to run by default.
# These are ordered.
TESTS := \
demography_support \
demography \
biography_data_deferred \
biography_data_null \
biography_data_entrybirth \
biography_data_departentry \
dad_male \
community_membership \
animid_ref_macro \
animid_immutable \
biography \
twins \
twins_reload \
chimpids_twins \
chimpids_req_row \
chimpids_autoinsert \
chimpids_autodel \
chimpids_uniq_bdi \
adoptions \
adoptions_twice \
adoptions_twice_twins \
adoptions_ub_ptooyoung \
adoptions_ub_ktooold \
adoptions_rev \
adoptions_ua_toosoon \
adoptions_ub_toosoon \
adoptions_ua_afterkid \
adoptions_ub_afterkid \
adoptions_ua_afterparent \
adoptions_ub_afterparent \
adoptions_ia_notmom \
adoptions_ub_notmom \
\
people \
followtypes \
followroles_error \
entry_follow_date_follows \
entry_follow_date_intervals \
entry_follow_date_sheets \
entry_follow_date_fieldfollows \
entrydate_null \
entrydate_null_follows \
entrydate_null_intervals \
entrydate_null_sheets \
entrydate_null_fieldfollows \
ff_uploaddate_entrydate \
sheets_errors \
sheets_deletes_fieldfollows \
intervals \
intervals_onesheet \
intervals_badtime \
intervals_timeearly \
intervals_timelate \
intervals_abandonsheet \
fieldfollows_collector \
sheets_collector \
intervals_collector \
follows_collector \
follows_nomom \
followparts_twice \
followparts_deletemom \
biography_beforefollow \
biography_afterfollow \
followparts_beforefollow \
followparts_afterfollow \
follows_tooearly \
follows_toolate \
followparts_sib \
followparts_sibrev \
biography_i_sibrev \
biography_u_sibrev \
followparts_twins \
followparts_badtwin \
biography_badtwin \
badtwinrole_fp \
badtwinrole_twins \
follows_dup \
followparts_dup \
followparts_if_badmom \
followparts_ub_badmom \
followparts_amom \
followparts_amom_nomom \
followparts_amom_ktooold \
followparts_ub_ktooold \
followparts_uf_ktooold \
followparts_if_badadate \
followparts_if_badadate2 \
followparts_ub_rmmom \
followparts_replace_bio \
followparts_ua_badadate \
followparts_da_noadopt \
follows_intervals_f \
follows_intervals_i \
\
gcstatus \
gcstatus_raw_groups_i \
gcstatus_raw_groups_d \
gcstatus_null_sheets \
gcstatus_nonnull_sheets \
gcstatus_null_fieldfollows \
gcstatus_nonnull_fieldfollows \
\
groupinfants \
groups_onintervals_groups \
grouplots_vacuum_analyze \
groups_onintervals_intervals_u \
groups_onintervals_intervals_d \
groups_a_n_s_groupmembers_e \
groups_a_n_s_groupmembers_d \
groups_a_n_s_biography_e \
groups_a_n_s_biography_d \
groups_a_n_s_intervals_e \
groups_a_n_s_intervals_d \
groups_a_n_s_follows_e \
groups_a_n_s_follows_d \
groups_momkid_900 \
groups_nomom_intervals \
groups_nomom_followparts \
groups_nomom_groupmembers_u \
groups_nomom_groupmembers_d \
swelling \
swelling_notmale \
swelling_notmale_biography \
swelling_minage \
swelling_nma_biography \
swelling_nma_groupmembers\
swelling_nma_intervals \
swelling_nma_follows \
\
distanceparts_lots \
distanceparts_twice \
not2dparts_d \
not2dparts_dpi \
not2dparts_dpd \
distoffp_dp \
distoffp_fp \
distoffp_intervals \
distoffp_distances \
distonfp_intervals \
distonfp_distances \
distonfp_dp \
distonfp_fpd \
distonfp_fpu \
disttwice_dp \
disttwice_d \
\
dp_in_gm_dp \
dp_in_gm_d \
dp_in_gm_i \
dp_in_gm_gm_d \
dp_in_gm_gm_u \
dp_distunk_is_true \
\
behaviors \
behaviors_exclude_restricted \
behaviors_both_directions_null \
behaviors_both_directions_non_null \
behaviors_baboon_null \
behaviors_baboon_non_null \
null_iff_not_true_nf \
null_iff_not_true_nt \
null_iff_not_true_tf \
null_iff_not_true_tt \
parts_lots \
other_mom_grooming \
other_grooming_infant \
infant_grooming_other \
infant_play_other_participant \
sib_grooms_infant \
sib_play_other_participant \
sib_eats \
other_grooming_sib \
sib_grooming_other \
mom_grooming_baboon \
parts_uniq_ind \
parts_tooearly \
parts_tooearly_b \
parts_tooearly_f \
parts_toolate \
parts_toolate_b \
parts_toolate_f \
event_unique_e \
event_unique_p \
eats0 \
eats1 \
eats0_d \
eats2 \
eats_rides \
rides0 \
rides1 \
rides0_d \
rides2 \
rides_eats \
fishing1 \
fishing_fishable_fp_u \
fishing_fishable_fp_i \
fishing_fishable_fk_u \
fishing_fishable_fk_i \
resting \
plays \
vocs \
\
pif_u_parts \
pif_d_parts \
pif_events \
pif_intervals \
pif_followparts_u \
pif_followparts_d \
\
behaviors_mom_actor \
behaviors_mom_actee \
behaviors_mom_participant \
behaviors_mom_self \
behaviors_mom_nf_actor \
behaviors_mom_nf_actee \
behaviors_mom_nf_participant \
behaviors_infant_actor \
behaviors_infant_actee \
behaviors_infant_participant \
behaviors_infant_self \
behaviors_infant_nf_actor \
behaviors_infant_nf_actee \
behaviors_infant_nf_participant \
behaviors_sib_actor \
behaviors_sib_actee \
behaviors_sib_participant \
behaviors_sib_self \
behaviors_sib_nf_actor \
behaviors_sib_nf_actee \
behaviors_sib_nf_participant \
behaviors_mom_baboon \
\
parts_mom_actor \
parts_mom_actee \
parts_mom_participant \
parts_mom_self \
parts_mom_nf_actor \
parts_mom_nf_actee \
\
events_mom_actor \
events_mom_actee \
events_mom_participant \
events_mom_self \
events_mom_nf_actor \
events_mom_nf_actee \
events_mom_nf_participant \
\
behaviors_position_true \
behaviors_position_false \
events_position \
events_no_parts \
events_3_parts \
events_2_parts_baboon \
parts_3_parts \
parts_1_part \
parts_1_part_baboon \
parts_2_self \
parts_self_baboon \
events_self_baboon \
parts_actor_actor \
parts_actor_actor_d \
parts_actee_actee \
parts_participant_participant \
parts_participant_baboon \
\
self_participant_play \
behaviors_both_directions \
parts_both_directions \
events_both_directions \
\
behaviors_restricted \
behaviors_exclusive \
behaviors_mom_restricted \
behaviors_mom_exclusive \
behaviors_er_uncertain \
behaviors_er_actee \
parts_restricted \
parts_exclusive \
parts_mom_restricted \
parts_mom_exclusive \
parts_er_uncertain \
parts_er_actee \
events_restricted \
events_exclusive \
events_mom_restricted \
events_mom_exclusive \
events_er_uncertain \
events_er_actee \
\
ff_interval \
ff_insert_out \
ff_interval1 \
ff_insert1_out \
ffu_date \
ffu_date_out \
ffu_mom \
ffu_mom_out \
ffu_newsib \
ffu_newsib_out \
ffud \
ffud_out \
ff_delete \
ff_delete_out \
ff_twins_out \
fi_out \
fi_i_followid \
fi_i_dmi \
fi_i_sheetid \
fi_i_page \
fi_i_ffid \
fi_i_collector \
fi_u_time \
fi_d \
fi_error \
fe_out \
fe_i_intid \
fe_i_dmit \
fe_i_ft \
fe_i_lots \
fe_u_behavior \
fe_u_chimpid \
fe_u_oldtonew \
fe_d \
de_out \
de_i_intid \
de_i_eats \
de_i_eats2 \
de_i_fished \
de_i_plays \
de_i_plays2 \
de_i_rests \
de_i_rides \
de_i_vocs \
de_i_vocs2 \
de_i_lots \
de_u_behavior \
de_u_vocs \
de_u_vocs2 \
de_u_eats \
de_u_eats2 \
de_u_plays \
de_u_plays2 \
de_u_rests \
de_u_rides \
de_u_eats_i \
de_u_fished_i \
de_u_plays_i \
de_u_rests_i \
de_u_rides_i \
de_u_vocs_i \
de_d \
fd_out \
fd_i_intid \
fd_i_dmit \
fd_i_ft \
fd_i_ft_mom_sib \
fd_i_lots \
fd_u_distance \
fd_u_chimpid \
fd_u_oldtonew \
fd_d \
\
iqtypes \
iq_i \
iq_i_notempty \
iq_i_nospace \
iq_u_iqname \
iq_u_last_early \
iw_i \
iw_u_last_early \
iw_u_resolved_early \
iw_u_deferred_early \
iw_u_resolve \
iq_u_make_error \
iq_u_resolve_errors \
iw_u_resolve_errors \
riq_badarg \
riq_bad_iqname \
riq_bad_squery \
riq_1_results \
riq_2_results \
riq_every_rtimestamp \
riq_every_stimestamp \
riq_one_stimestamp \
riq_resolved \
riq_future \
riq_past \
riq_no_problem
# Tests that require transactions.
# When tests which require a transaction are dependencies,
# the transaction is started when the dependency is fulfilled
# but not before. I.e. Not necessarily before _any_ data is loaded.
#
# Transactions are catagorized into two sorts, those that raise
# errors and those that don't. Transactions which raise errors
# have the COMMIT included in their test output. This allows
# capture of errors raised by DEFERREABLE INITIALLY DEFERRED
# constraints and CONSTRAINT triggers.
ERROR_FREE_TRANSACTIONS := \
twins_reload \
fieldfollows1 \
fieldfollows2 \
fieldfollows3 \
fieldfollows4 \
fieldfollows5 \
fieldfollows6 \
fieldfollows7 \
fieldfollows1_late_entrydate \
fieldfollows2_null_entrydate \
fieldfollows1_gcstatus \
sheets \
sheets_gcstatus \
sheets_deletes_fieldfollows \
sheets_second \
sheets_third \
sheets_fourth \
sheets_fifth \
sheets_sixth \
intervals \
follows1_data \
follows2_data \
follows3_data \
follows4_data \
follows5_data \
follows6_data \
followparts2 \
followparts5 \
followparts6 \
followparts_sib \
followparts_sib_noi \
followparts_twins \
followparts_amom \
followparts_amom_noi \
followparts_amom_nomom \
followparts_replace_bio \
intervals_first_follow \
intervals_third_follow \
intervals_fourth_follow \
intervals_lots_follow1 \
intervals_lots_follow2 \
intervals_lots_day2 \
intervals_lots \
intervals_sixth_follow \
intervals_3rd_late \
entrydate_null \
follows1_after_null_entrydate \
follows2_after_null_entrydate \
gcstatus \
raw_groups1 \
raw_groupmembers1 \
groups \
groups_onemom \
groups_onemom_900 \
groups_onemom902 \
groups_momkid_900 \
groups_momkid902 \
groupmoms_day1 \
groupmoms_day2 \
groupmoms \
groupinfants_day1 \
groupinfants_day2 \
groupinfants \
grouplots \
grouplots_vacuum_analyze \
swelling \
swelling_minage \
distanceparts_lots \
distance_one \
ninethirty_sheet \
distancepart_extra \
follow3_twin \
distanceparts_one \
distancepart_extra2 \
distanceparts900 \
parts_lots \
parts_lots_dad_mom_grooming \
parts_lots_i_selfplay \
parts_lots_infant_eating \
parts_lots_infant_mom_grooming \
parts_lots_infant_mom_play \
parts_lots_infant_nursing \
parts_lots_infant_other \
parts_lots_infant_resting \
parts_lots_infant_self_play \
parts_lots_infant_sib_grooming \
parts_lots_mom_baboon_grooming \
parts_lots_mom_dad_grooming \
parts_lots_mom_eating \
parts_lots_mom_infant_grooming \
parts_lots_mom_ma5_play_nondirected \
parts_lots_mom_other \
parts_lots_mom_resting \
parts_lots_mom_unknown_grooming \
parts_lots_mom_unknown_grooming2 \
parts_lots_after_noc_sheet \
other_mom_grooming \
other_grooming_infant \
infant_grooming_other \
infant_play_other_participant \
sib_grooms_infant \
sib_play_other_participant \
sib_eats \
other_grooming_sib \
sib_grooming_other \
mom_grooming_baboon \
eats \
eats1 \
eats2 \
rides \
rides1 \
fishing \
fishing1 \
resting \
plays \
vocs \
nineoclock_sheet \
parts_1_part_baboon \
parts_participant_baboon \
behaviors_er_uncertain \
behaviors_er_actee \
parts_er_uncertain \
parts_er_actee \
events_er_uncertain \
\
ff_insert \
ff_insert_out \
ff_insert1 \
ff_insert1_out \
ffu_date \
ffu_mom \
ffu_newsib \
ffud \
ff_delete \
fd_i_lots
ERROR_RAISING_TRANSACTIONS := \
dad_male \
adoptions_ub_ptooyoung \
adoptions_ub_ktooold \
adoptions_ua_toosoon \
adoptions_ub_toosoon \
adoptions_ua_afterkid \
adoptions_ub_afterkid \
adoptions_ua_afterparent \
adoptions_ub_afterparent \
adoptions_ia_notmom \
adoptions_ub_notmom \
\
ff_uploaddate_entrydate \
fieldfollows_needs_sheets \
sheets_errors \
intervals_onesheet \
intervals_badtime \
intervals_timeearly \
intervals_timelate \
intervals_abandonsheet \
fieldfollows_collector \
sheets_collector \
intervals_collector \
follows_collector \
entry_follow_date_follows \
entry_follow_date_intervals \
entry_follow_date_sheets \
entry_follow_date_fieldfollows \
entrydate_null_follows \
entrydate_null_intervals \
entrydate_null_sheets \
entrydate_null_fieldfollows \
follows_nomom \
followparts_twice \
followparts_deletemom \
biography_beforefollow \
biography_afterfollow \
followparts_beforefollow \
followparts_afterfollow \
follows_tooearly \
follows_toolate \
followparts_sibrev \
biography_i_sibrev \
biography_u_sibrev \
followparts_badtwin \
biography_badtwin \
badtwinrole_fp \
badtwinrole_twins \
follows_dup \
followparts_dup \
followparts_amom_ktooold \
followparts_ub_ktooold \
followparts_uf_ktooold \
followparts_if_badmom \
followparts_ub_badmom \
followparts_if_badadate \
followparts_if_badadate2 \
followparts_ub_rmmom \
followparts_ua_badadate \
followparts_da_noadopt \
follows_intervals_f \
follows_intervals_i \
\
gcstatus_raw_groups_i \
gcstatus_raw_groups_d \
gcstatus_null_sheets \
gcstatus_nonnull_sheets \
gcstatus_null_fieldfollows \
gcstatus_nonnull_fieldfollows \
\
groups_onintervals_intervals_u \
groups_onintervals_intervals_d \
groups_a_n_s_groupmembers_e \
groups_a_n_s_groupmembers_d \
groups_a_n_s_biography_e \
groups_a_n_s_biography_d \
groups_a_n_s_intervals_e \
groups_a_n_s_intervals_d \
groups_a_n_s_follows_e \
groups_a_n_s_follows_d \
groups_nomom_intervals \
groups_nomom_followparts \
groups_nomom_groupmembers_u \
groups_nomom_groupmembers_d \
swelling_notmale \
swelling_notmale_biography \
swelling_nma_biography \
swelling_nma_groupmembers \
swelling_nma_intervals \
swelling_nma_follows \
\
distanceparts_twice \
not2dparts_d \
not2dparts_dpi \
not2dparts_dpd \
distoffp_dp \
distoffp_fp \
distoffp_intervals \
distoffp_distances \
distonfp_intervals \
distonfp_distances \
distonfp_dp \
distonfp_fpd \
distonfp_fpu \
disttwice_dp \
disttwice_d \
\
dp_in_gm_dp \
dp_in_gm_d \
dp_in_gm_i \
dp_in_gm_gm_d \
dp_in_gm_gm_u \
dp_distunk_is_true \
\
parts_uniq_ind \
parts_tooearly \
parts_tooearly_b \
parts_tooearly_f \
parts_toolate \
parts_toolate_b \
parts_toolate_f \
event_unique_e \
event_unique_p \
eats0 \
eats0_d \
eats_rides \
rides0 \
rides0_d \
rides2 \
rides_eats \
fishing_fishable_fp_u \
fishing_fishable_fp_i \
fishing_fishable_fk_u \
fishing_fishable_fk_i \
pif_u_parts \
pif_d_parts \
pif_events \
pif_intervals \
pif_followparts_u \
pif_followparts_d \
\
behaviors_mom_actor \
behaviors_mom_actee \
behaviors_mom_participant \
behaviors_mom_self \
behaviors_mom_nf_actor \
behaviors_mom_nf_actee \
behaviors_mom_nf_participant \
behaviors_infant_actor \
behaviors_infant_actee \
behaviors_infant_participant \
behaviors_infant_self \
behaviors_infant_nf_actor \
behaviors_infant_nf_actee \
behaviors_infant_nf_participant \
behaviors_sib_actor \
behaviors_sib_actee \
behaviors_sib_participant \
behaviors_sib_self \
behaviors_sib_nf_actor \
behaviors_sib_nf_actee \
behaviors_sib_nf_participant \
behaviors_mom_baboon \
\
parts_mom_actor \
parts_mom_actee \
parts_mom_participant \
parts_mom_self \
parts_mom_nf_actor \
parts_mom_nf_actee \
\
events_mom_actor \
events_mom_actee \
events_mom_participant \
events_mom_self \
events_mom_nf_actor \
events_mom_nf_actee \
events_mom_nf_participant \
\
behaviors_position_true \
behaviors_position_false \
events_position \
events_no_parts \
events_3_parts \
events_2_parts_baboon \
parts_3_parts \
parts_1_part \
parts_2_self \
parts_self_baboon \
events_self_baboon \
parts_actor_actor \
parts_actor_actor_d \
parts_actee_actee \
parts_participant_participant \
\
self_participant_play \
behaviors_both_directions \
parts_both_directions \
events_both_directions \
\
behaviors_restricted \
behaviors_exclusive \
behaviors_mom_restricted \
behaviors_mom_exclusive \
parts_restricted \
parts_exclusive \
parts_mom_restricted \
parts_mom_exclusive \
events_restricted \
events_exclusive \
events_mom_restricted \
events_mom_exclusive \
events_er_actee \
\
fi_error
# Test prerequisites. (These are immediate prerequisites, you need not
# chase back through the dependencies.)
# It is optional for a test to have prerequsites.
# The names of these must have 'prereq_' and then the name of
# the test.
# Tip: If the prerequsite is not a test itself and is
# shared by multiple tests do not have the sql
# select generated keys.
# Load basic biography_data: MOM, KID, DAD, MGE
prereq_demography := demography_support
# Create an unknown individual: UNK
prereq_unk := demography_support
# Try to make a female a dad.
prereq_dad_male := demography female4
prereq_sib := demography
# Add a second sibling (animid='SB2', mom = 'MOM') not as old as SIB
prereq_sib2 := demography
prereq_biography_data_deferred := demography
prereq_biography_data_null := demography
# Needs filter (import_datetime)
prereq_biography_data_entrybirth := demography_support
# Needs filter (import_datetime)
prereq_biography_data_departentry := demography_support
prereq_community_membership := demography
# Needs filter (referenced table name when deleting)
prereq_animid_ref_macro := community_membership
prereq_animid_immutable := demography
prereq_biography := demography_support
# Make KID into a twin (TWN)
prereq_twins := demography
prereq_twins_reload := twins
# Make KID 5 years old.
# (This is likely a bad idea, but works for now.)
prereq_kid5 := demography
# Give twins some virtual identifiers.
prereq_chimpids_twins := twins
# Chimpids must have a row with chimpid=animid for each biography_data row:
# delete of chimpids.
prereq_chimpids_req_row := demography
# Chimpids rows are automatically created upon insertion of biography_data.
prereq_chimpids_autoinsert := demography
# Chimpids rows are automatically deleted upon deletion of biography_data.
prereq_chimpids_autodel := demography
# Chimpid values cannot be used as biography_data.animid values:
# insert of biography_data.
prereq_chimpids_uniq_bdi := chimpids_twins
prereq_male3 := demography_support
prereq_male4 := demography_support
prereq_male5 := demography_support
# A male who's gone 2000-01-01
prereq_male6 := demography_support
# A young (birth 2004-01-01, gone 2012-01-01) male, with no mom
prereq_male7 := demography_support
# A young (birth 2004-01-01, gone 2012-01-01) male, with mom of FE4
prereq_male8 := demography_support female4
# A young (birth 2005-01-01, gone 2012-01-01) male, with mom of FE4
prereq_male9 := demography_support female4
# An old male (birth 1994-01-01, gone 2012-01-01) male, with mom of FE4
prereq_male10 := demography_support female4
# A young male (birth 2003-01-01, gone 2012-01-01) male, with mom of FE5
prereq_male11 := demography_support female5
prereq_female1 := demography_support
prereq_female2 := demography_support
prereq_female3 := demography_support
prereq_female4 := demography_support
prereq_female5 := demography_support
prereq_female6 := demography_support female4
# Add one adoption: MA3 adopts KI2
prereq_adoptions := adoptions_prereqs
# Cannot be adopted twice by the same parent: same chimpid
prereq_adoptions_twice := adoptions
# Cannot be adopted twice by the same parent: different chimpid
prereq_adoptions_twice_twins := adoptions4 chimpids_twins
# Add a second adoptions: DAD adopts MA3
prereq_adoptions2 := male3 demography adoptions
# Add a third adoption: DAD adopts MA4
prereq_adoptions3 := demography male4 adoptions2
# Add a fourth adoption: DAD adopts KID
prereq_adoptions4 := demography
prereq_adoptions_ub_ptooyoung := adoptions3
prereq_adoptions_ub_ktooold := adoptions3
# Adopting parent must be older than adopted kid: insert of adoptions
prereq_adoptions_rev := adoptions_prereqs
# Date of adoption cannot be before birth of adopted individual:
# update adoptions.adate
prereq_adoptions_ua_toosoon := adoptions3
# Date of adoption cannot be before birth of adopted individual:
# update biography_data.birthdate
prereq_adoptions_ub_toosoon := adoptions3
# Date of adoption cannot be after departdate of adopted individual:
# update adoptions.adate
prereq_adoptions_ua_afterkid := adoptions3
# Date of adoption cannot be after departdate of adopted individual:
# update biography_data.departdate
prereq_adoptions_ub_afterkid := adoptions3
# Date of adoption cannot be after departdate of adoptive parent:
# update adoptions.adate
prereq_adoptions_ua_afterparent := adoptions3
prereq_adoptions_ub_afterparent := adoptions3
# A mother cannot adopt her own child: insert into adoptions
prereq_adoptions_ia_notmom := demography
# A mother cannot adopt her own child: update biography_data
prereq_adoptions_ub_notmom := demography family2
# A second family
prereq_family2 := demography_support
# Add an older male sibling to family2.
prereq_si2 := family2
prereq_followrole_twin := followroles
# Follow 1 (followid = 1) 2004-06-01 (usually to go with MOM and KID)
prereq_follows1_data := follow_prereqs
# Follow 2 (followid = 2) 2004-06-01 (usually with MO2 and KI2)
prereq_follows2_data := follows1_data
# Follow number 3, without having to have follow 1 or 2.
# (followid = 3) 2004-06-02 (usually with MOM and KID)
prereq_follows3_data := follow_prereqs
# Follow number 5, a 20 year old follow, without having to have follows 1-4.
# Date 1993-04-01. followid = 5 Usually with FE4 (mom) and FE6 (infant).
prereq_follows5_data := follow_prereqs
# Follow number 6, another contemporary follow (with FE4 (mom) and FE6 (kid))
# (followid = 6) Date 2004-06-03
prereq_follows6_data := follow_prereqs
prereq_follows := follows2_data followparts
# Date of the follow cannot be after the data entry date: update of follows.
# Needs filter (time)
prereq_entry_follow_date_follows := intervals_first_follow followparts1
# Date of the follow cannot be after the data entry date: update of intervals.
# Use first and third follows, make the entrydate of the first the same as the
# followdate and then move an interval from the 1st to the 3rd follow.
# Needs filter (time)
prereq_entry_follow_date_intervals := intervals_3rd_late followparts13
# Date of the follow cannot be after data entry daet: update of sheets.
# Use first follow and move the sheet to a different fieldfollow.
# (Delete the unused fieldfollow so it's not left without a sheet.)
prereq_entry_follow_date_sheets := intervals_first_follow followparts1 \
fieldfollows7
# Date of the follow cannot be after the data entry date:
# update of fieldfollows.
prereq_entry_follow_date_fieldfollows := intervals_first_follow followparts1
# Date of data entry cannot be null after gmi_max_null_entrydate
#
# Test entrydate _can_ be null before the max date.
prereq_entrydate_null := intervals_first_follow followparts1
# Setup follow 1 so that it's date is after gmi_max_null_entrydate.
prereq_follows1_after_null_entrydate := follows1_data \
fieldfollows1_late_entrydate
# Setup follow 2 so that it's date is after gmi_max_null_entrydate.
prereq_follows2_after_null_entrydate := follows2_data
# Setup fieldfollow 1 so that it has a late entrydate to match
# the follows.date of follows1_after_null_entrydate.
prereq_fieldfollows1_late_entrydate := fieldfollows1
# Setup fieldfollow 2 so it has a null entrydate.
prereq_fieldfollows2_null_entrydate := fieldfollows2
# Date of data entry cannot be null after the max date: update of follows
# Needs filter (time)
prereq_entrydate_null_follows := entrydate_null
# Date of data entry cannot be null after the max date: update of intervals
# Have follow 1 with intervals and a null entrydate, follow 2 with
# no intervals and a date after gmi_max_null_entrydate. Move intervals
# from follow 1 to follow 2.
# Needs filter (intid, time)
prereq_entrydate_null_intervals := entrydate_null follows2_after_null_entrydate
# Date of data entry cannot be null after the max date: update of sheets
# Change follow1 to be after max_null_entrydate. Move the sheet
# to a fieldfollows row with a null entrydate.
prereq_entrydate_null_sheets := intervals_first_follow followparts1 \
follows1_after_null_entrydate sheets_second \
fieldfollows2_null_entrydate
# Date of data entry cannot be null after the max date: update of fieldfollows
prereq_entrydate_null_fieldfollows := follows1_after_null_entrydate \
intervals_first_follow followparts1
# Insert first field follow to be used with first follow: ffid = 1
prereq_fieldfollows1 := followtypes people
# A fieldfollow identical to fieldfollows1 but with a non-null gcstatus.
prereq_fieldfollows1_gcstatus := followtypes people gcstatuses
# Insert a fieldfollows and get error because there's no related sheets row.
prereq_fieldfollows_needs_sheets := followtypes people
# Insert a fieldfollow and get an error because the upload date is
# before the entry date.
prereq_ff_uploaddate_entrydate := followtypes people gcstatuses
# Insert second field follow to be used with 2nd follow: ffid = 2
# (And in conjunction with the first follow.)
# (Has a different collector since follow 2 is the same date as follow 1.)
prereq_fieldfollows2 := fieldfollows1
# Insert a sheet, sheetid = 1, that uses fieldfollows.ffid = 1
prereq_sheets := fieldfollows1
# A sheet identical to sheets1 but using a fieldfollow with a gcstatus.
prereq_sheets_gcstatus := fieldfollows1_gcstatus
# Deleting the last sheet deletes the related fieldfollow row.
prereq_sheets_deletes_fieldfollows := sheets
# Insert (in conjunction with sheet #1) a second sheet,
# sheetid = 2, that uses fieldfollows.ffid = 2
prereq_sheets_second := sheets fieldfollows2
# Every sheets row must have a related intervals row.
prereq_sheets_errors := sheets_second follows2_data
# Populate 3 intervals for the first follow: 9:00, 9:01, 9:02
prereq_intervals_first_follow := sheets follows1_data
# Populate 3 more intervals for the 2nd follow: 10:00, 10:01, 10:02
prereq_intervals := sheets_second follows2_data \
intervals_first_follow followparts1 followparts2
# Add intervals to the 3rd follow like those on intervals_first_follow.
prereq_intervals_third_follow := sheets_third follows3_data
# Add intervals to the 4th follow like those on intervals_first_follow.
# (Sheets need 3rd sheet so this needs intervals for 3rd sheet.)
prereq_intervals_fourth_follow := sheets_fourth follows4_data \
intervals_third_follow
prereq_intervals_onesheet := intervals_prereqs intervals_first_follow
prereq_intervals_badtime := intervals_prereqs
prereq_intervals_timeearly := intervals_prereqs
prereq_intervals_timelate := intervals_prereqs
# Delete all a sheet's intervals.
# (This cascades to deleting the abandoned sheet.)
prereq_intervals_abandonsheet := intervals
# Populate 3 intervals for the sixth follow: 9:00, 9:01, 9:02
prereq_intervals_sixth_follow := sheets_sixth follows6_data
# A field data collector cannot be in 2 places at once.
# Update of fieldfollows: fieldfollows.collector
# Needs filter: time
prereq_fieldfollows_collector := intervals intervals_extra_2nd
# A field data collector cannot be in 2 places at once.
# Update of sheets: Move a sheet from fieldfollow 2 to fieldfollow 3.
# Needs filter: time
prereq_sheets_collector := intervals fieldfollows3 intervals_extra_2nd
prereq_intervals_extra_2nd := intervals_prereqs intervals_first_follow
# A field data collector cannot be in 2 places at once.
# Insert into intervals: Put a interval on the third sheet for follow 2;
# there is a time conflict at 9:00 for the collector.
prereq_intervals_collector := intervals sheets_third
# Insert a 3rd field follow to be used with the 3rd follow: ffid = 3
# (And it can be used independently.)
prereq_fieldfollows3 := followtypes people
# Insert a 3rd sheet, using fieldfollows.ffid = 3, to be used independently.
# (sheets.sheetid = 3)
prereq_sheets_third := fieldfollows3
# A field data collector cannot be in 2 places at once.
# Update follows: Make follow 3 same date as follow 1
# Needs filter: time
prereq_follows_collector := intervals followparts6 \
intervals_sixth_follow
# Add follows 1-3 and intervals for all 3.
prereq_intervals_extra_3rd := intervals sheets_third
# Add follows 1-3 and intervals for all 3. Follow 3 interval times
# and collector does not conflict with those of follow 1.
# (The fifth sheet is used.)
prereq_intervals_3rd_late := intervals sheets_fifth follows3_data
prereq_follows_nomom := follow_prereqs
# Populate the followparts part of the db for the first follow
# MOM (mom) and KID (infant)
prereq_followparts1 := follows1_data followpart_basic_prereqs demography
# Test that follows must have related intervals. Insert of follows.
# (Same as followparts1, but output keeps transaction failure.
prereq_follows_intervals_f := follows1_data followpart_basic_prereqs \
demography
# Test that follows must have related intervals. Delete of intervals.
# Needs filter (intid, time)
prereq_follows_intervals_i := intervals_first_follow followparts1
# Populate the followparts part of the db for the (first and) third follow
# 2004-06-02, same as follow 1. With MOM (mom) and KID (infant)
prereq_followparts13 := followparts1 follows3_data
# Populate the followparts part of the db for the second follow
# MO2 (mom) and KI2 (infant)
prereq_followparts2 := followpart_prereqs follows2_data
# Participants for follow 5, the old follow.
# FE4 (mom) and FE6 (infant)
prereq_followparts5 := followpart_basic_prereqs follows5_data female6
# Participants for follow 6, the contemporary extra follow
# FE4 (mom) and FE6 (infant)
prereq_followparts6 := followpart_basic_prereqs follows6_data female6
# Cannot be in the same follow twice.
prereq_followparts_twice := followparts1
# Cannot delete the mom from a follow
prereq_followparts_deletemom := followparts1 intervals_first_follow
prereq_biography_beforefollow := followparts1 intervals_first_follow
prereq_biography_afterfollow := followparts1 intervals followparts2
# An individual cannot be in a follow before entry into the study
# population: followparts insert
prereq_followparts_beforefollow := followpart_basic_prereqs family2
# Cannot be in a follow after departure from the study population:
# followparts insert
prereq_followparts_afterfollow := followpart_basic_prereqs family2
# Cannot be in a follow before entry into the study population: follows update
prereq_follows_tooearly := followparts intervals
# Needs filter (chimpid, departdate)
prereq_follows_toolate := followparts intervals
# Add a sibling (SIB) to follow 1.
prereq_followparts_sib := followparts1 sib intervals_first_follow
# Same as followparts_sib but without intervals for use as a prerequsite.
prereq_followparts_sib_noi := followparts1 sib
# The sib cannot be younger than the infant: insert of of followparts
prereq_followparts_sibrev := follows1_data followpart_basic_prereqs sib
prereq_biography_i_sibrev := followparts_sib
prereq_biography_u_sibrev := followparts_sib
# Add a twin (TWN) to the focals of the first follow.
prereq_followparts_twins := followparts1 intervals_first_follow twins
# Animals sharing a role in a follow must have the same birthdate.
prereq_followparts_badtwin := followparts sib
prereq_biography_badtwin := followparts_twins
# Twins must have equal followparts.role values: update of followparts
# Needs filter (fpid)
prereq_badtwinrole_fp := followparts_twins followrole_twin
prereq_badtwinrole_twins := followparts_sib
# Needs filter (chimpid)
prereq_follows_dup := followparts
# Can't have two individuals in a follow on the same day: insert followparts
prereq_followparts_dup := followpart_prereqs follows1_data follows3_data \
followparts13 follows2_data
prereq_followparts := followparts13 followparts2
# Test that the mom in a follow is a mom: wrong mom, no adoptions
prereq_followparts_if_badmom := follows1_data followpart_prereqs
prereq_followparts_ub_badmom := follows1_data follows2_data intervals
# Populate 4th follow on 2nd day.
# (followid = 4) 2004-06-02, same day as follow 2 (Usually with MA3
# (male adopted mom) and KI2 (infant).)
prereq_follows4_data := follows1_data follows2_data
# Insert followparts to a follow (followid=4) with an adopted mom.
prereq_followparts_amom := followparts_amom_prereqs
# Same as followparts_amom but with no intervals as prereqs.
# Used strictly for prerequsites.
prereq_followparts_amom_noi := followparts13 adoptions3 follows1_data \
follows4_data
# Insert followparts to a follow (followid=4) with an adopted parent
# that's male and when the infant has no biological mom.
prereq_followparts_amom_nomom := followparts_amom_prereqs
# Insert a follow that has a kid who is too old as of the date of the follow
prereq_followparts_amom_ktooold := followparts_amom_prereqs
# Needs filter (follow.date)
prereq_followparts_ub_ktooold := followparts_amom
# Infant and sib must be less than 9 years old as of the follow date:
# update follows
prereq_followparts_uf_ktooold := followparts5
# Adopted youth with no mom can't be in a follow before the
# adoption date: insert into followparts
prereq_followparts_if_badadate := followparts_amom_prereqs
# Adopted youth with mom can't be in a follow before the
# adoption date: insert into followparts
prereq_followparts_if_badadate2 := followparts_amom_prereqs
# Mom must be mom on follow: update biography_data to make not a mom
# Needs filter (follow.date)
prereq_followparts_ub_rmmom := followparts_amom intervals \
intervals_third_follow \
intervals_fourth_follow
prereq_followparts_replace_bio := followparts_amom
# Cannot participate in a follow before being
# adopted: update of adoptions.adate
prereq_followparts_ua_badadate := followparts_amom
# Cannot participate in a follow before being adopted: delete of adoptions
prereq_followparts_da_noadopt := followparts_amom
# prerequsites for groups
# Have a follows.gcstatus if and only if there is a raw_groups row.
#
# Insert raw_groupmembers to go with intervals_first_follow.
prereq_raw_groupmembers1 := raw_groups1 gm_origins
# Can have a follows.gcstatus when there's a raw_groups row.
# (Give the first fieldfollow a gcstatus.)
prereq_gcstatus := gcstatuses raw_groupmembers1
# Insert a raw_groups row for follow 1 as a prerequsite for later tests.
prereq_raw_groups1 := intervals_first_follow followparts1
# Must have a follows.gcstatus if there's a raw_groups row.
# Insert of raw_groups.
prereq_gcstatus_raw_groups_i := intervals_first_follow followparts1
# Must not have a gcstatus if there is no raw_groups row.
# Delete a raw_groups row without updating gcstatus.
prereq_gcstatus_raw_groups_d := gcstatus
# Must have a follows.gcstatus if there's a raw_groups row.
# Update of sheets. Start with a follow 1 with a raw_groups row
# fieldfollow 2 with a null gcstatus.
# Change the sheets rows to use fieldfollow 2 and delete fieldfollow 1.
# (Error is on insert commit, since it checks using the updated value.)
prereq_gcstatus_null_sheets := gcstatus fieldfollows2
# Must not have a follows.gcstatus if there's no raw_groups row.
# Insert of sheets.
# Identical to intervals_first_follow but with different prerequsites
# that have a non-null fieldfollows.gcstatus value.
prereq_gcstatus_nonnull_sheets := sheets_gcstatus follows1_data
# Must have a gcstatus if there is a raw_groups row.
# Update of fieldfollows.
prereq_gcstatus_null_fieldfollows := gcstatus
# Must not have a gcstatus when there are no raw_groups rows.
# Update of fieldfollows.
prereq_gcstatus_nonnull_fieldfollows := intervals_first_follow followparts1 \
gcstatuses
# get lots of intervals in, for four follows
# We'll need 4 sheets (without fussing and having
# multiple sheets per follow.)
# A forth field follow, for use with the 3rd. ffid = 4
prereq_fieldfollows4 := fieldfollows3
prereq_sheets_fourth := sheets_third fieldfollows4
# An extra fieldfollows for use with the 4th when we need it. ffid = 5
#prereq_fieldfollows5 :=
# A fieldfollow for use with the 6th follow (and independently), ffid = 6
# Has the same collector as fieldfollow1 so we can generate a conflict.
prereq_fieldfollows6 := followtypes people
# An extra early fieldfollow ffid = 7.
prereq_fieldfollows7 := followtypes people
# An extra sheet for when we need it.
prereq_sheets_fifth := fieldfollows5
# A sheet for fieldfollow 6, for independent use. (sheetid = 6)
prereq_sheets_sixth:= fieldfollows6
# And add intervals from 9am to 5pm for each follow.
# followparts_amom provides mom/infant for 4th follow.
prereq_intervals_lots_follow1 := sheets followparts1
prereq_intervals_lots_follow2 := sheets_second followparts2
prereq_intervals_lots_day2 := sheets_fourth followparts_amom_noi
prereq_intervals_lots := intervals_lots_day1 intervals_lots_day2
# Now that there's intervals we add lots of groups.
# We'll have all the follows and all the intervals when
# working with groups.
prereq_groups_day1 := intervals_lots
prereq_groups_day2 := intervals_lots
prereq_groups := groups_day1 groups_day2
# The groups all need the follow mom as a member:
# Test to be sure this is true.
# The groups all need the follow mom as a member: update of intervals
prereq_groups_nomom_intervals := intervals_lots_follow1
# The groups all need the follow mom as a member: update of followparts
prereq_groups_nomom_followparts := groups_momkid_900 family2
# The groups all need the follow mom as a member: update of groupmembers
# (Could use groups_momkid_900 instead of groupinfants to be faster.)
# Needs filter (date, time)
prereq_groups_nomom_groupmembers_u := groupinfants male4
# The groups all need the follow mom as a member: delete of groupmembers
# (Could use groups_momkid_900 instead of groupinfants to be faster.)
# Needs filter (date, time)
prereq_groups_nomom_groupmembers_d := groupinfants
# Moms for the follows in the first day.
prereq_groupmoms_day1 := groups_day1
# Moms for the follows in the second day.
prereq_groupmoms_day2 := groups_day2
prereq_groupmoms := groupmoms_day1 groupmoms_day2
# The groups all need to have intervals: update of intervals
# (This is probably not implemented correctly now that
# setting gid to null triggers group comp lookup.
# It probably only works because there's not anything in raw_groups.)
# Needs filter (intid, gid, time)
prereq_groups_onintervals_intervals_u := groupinfants
# Add one group with just the mom to the first follow.
prereq_groups_onemom := intervals_lots_follow1
# Add one group with just the mom to the first follow, 9:00
prereq_groups_onemom_900 := intervals_first_follow followparts1
# Add one group with just the mom to the first follow, 9:02
# When we use this, we want the kid to be more than 5 years old.
prereq_groups_onemom902 := intervals_first_follow followparts1 kid5
# The groups all need to have intervals: delete of intervals
prereq_groups_onintervals_intervals_d := groups_onemom kid5
# Infants for the follows in the first day.
prereq_groupinfants_day1 := groupmoms_day1
# Infants for the follows in the second day.
prereq_groupinfants_day2 := groupmoms_day2
# Have the infants and moms in the follow be group members.
prereq_groupinfants := groupmoms groupinfants_day1 groupinfants_day2
# Add male4 (MA4), and female1 (FE1)
# to groups of follow 1, and male2 (MA2) and female2 (FE2)
# to groups of follow 2. (Follows 1 and 2 share the same
# date, and follows 3 and 4 share the next date.)
prereq_grouplots_day1 := groupinfants_day1 male4 male5 female1 female2
# Add male4 (MA4), and female1 (FE1)
# to groups of follow 3, and male2 (MA2) and female2 (FE2)
# to groups of follow 4. (Follows 1 and 2 share the same
# date, and follows 3 and 4 share the next date.)
prereq_grouplots_day2 := groupinfants_day2 male4 male5 female1 female2
prereq_grouplots := grouplots_day1 grouplots_day2
prereq_grouplots_vacuum_analyze := grouplots
# Individual in group not in study group, enters late: insert into groupmembers
prereq_groups_a_n_s_groupmembers_e := grouplots female3
# Individual in group not in study group,
# leaves early: insert into groupmembers
prereq_groups_a_n_s_groupmembers_d := grouplots male6
# Individual in group not in study group, enters late: update of biography_data
# Needs filter, follows.date
prereq_groups_a_n_s_biography_e := grouplots
# Individual in group not in study group,
# leaves early: update of biography_data
# Needs filter, follows.date
prereq_groups_a_n_s_biography_d := grouplots
# Individual in group not in study group, enters late: update of intervals
# Needs filter (intid)
prereq_groups_a_n_s_intervals_e := grouplots_day2
# Individual in group not in study group, leaves early: update of intervals
# Needs filter (intid)
prereq_groups_a_n_s_intervals_d := grouplots_day1
# Individual in group not in study group, enters late: update of follows
prereq_groups_a_n_s_follows_e := grouplots
# Individual in group not in study group, departs early: update of follows
prereq_groups_a_n_s_follows_d := grouplots
# Add swelling to a group member FE1.
prereq_swelling := grouplots
# Can't give swelling to a male (MA5): update of groupmembers
# Needs filter (gmid)
prereq_swelling_notmale := grouplots
# Can't give swelling to a male: update of biography_data
prereq_swelling_notmale_biography := swelling
# Test that you can have swelling at the minimum age.
prereq_swelling_minage := swelling
# Can't have swelling at less than the minimum age: update biography_data
prereq_swelling_nma_biography := swelling_minage
# Can't have swelling at less than the minimum age: update of groupmembers
# Needs filter (gmid)
prereq_swelling_nma_groupmembers := grouplots
# Can't have swelling at less than the minimum age: update of intervals
# Needs filter (intid, time)
prereq_swelling_nma_intervals := groupinfants female2
# Can't have a swelling at less than the minimum age: update of follows
prereq_swelling_nma_follows := swelling_minage
# Prerequsites for distances
# Add lots of distances to the db for follows 1-4, 9:00, 10:00, 11:00
prereq_distanceparts_lots := intervals_lots followparts_sib_noi distancecodes
# Must have 2 individuals per distance measurement: insert of distances
prereq_not2dparts_d := intervals distancecodes
# Add a single distance row to the db, for follow 1, 9:00.
# (Technically we don't need followparts1 for this, but all the
# tests that depend on distance_one do.)
prereq_distance_one := intervals_first_follow distancecodes followparts1
# Insert a single distanceparts row, follow 1, 9:00.
prereq_distanceparts_one := distance_one
# Distance must be measured between two different individuals.
prereq_distanceparts_twice := distanceparts_one
# Must have 2 individuals per distance measurement: insert of distanceparts
prereq_not2dparts_dpi := distance_one
# Must have 2 individuals per distance measurement: delete of distanceparts
prereq_not2dparts_dpd := distanceparts_lots
# Distancepart must = role of followpart: insert of distanceparts
# (distoff is distancepartrole-of-followpart)
prereq_distoffp_dp := distanceparts_lots
# Distancepart must = role of followpart: update of followparts
prereq_distoffp_fp := distanceparts_lots followrole_twin
# Put the 9:30 interval onto it's own sheet so we can play around.
prereq_ninethirty_sheet := intervals_lots five_sheets
# An extra 9:30 distancepart pair for follow1.
prereq_distancepart_extra := distancecodes ninethirty_sheet
# An extra 9:30 distancepart pair for follow1, but without a 5th sheet.
prereq_distancepart_extra2 := intervals_lots distancecodes
# Set the 'KID' role for follow3 to 'T' (twin)
prereq_follow3_twin := followparts13 followrole_twin
# Distancepart must = role of followpart: update of intervals
prereq_distoffp_intervals := distancepart_extra follow3_twin
# Distancepart must = role of followpart: update of distances
prereq_distoffp_distances := distanceparts_lots distancepart_extra2 \
follow3_twin
# Distancepart must be on the followparts table: update of intervals
# (distonfp is distancepart-on-followpart)
# Needs filter, animid (twice)
prereq_distonfp_intervals := distancepart_extra
# Distancepart must be on the followparts table: update of distances
# Needs filter, chimpid (twice)
prereq_distonfp_distances := distancepart_extra
# Distancepart must be on the followparts table: insert of distanceparts
# Needs filter, dpid, participant (twice)
prereq_distonfp_dp := distance_one family2
# Distancepart must be on the followparts table: delete of followparts
# Needs filter intervals.time, followparts.animid (twice)
prereq_distonfp_fpd := distanceparts_lots
# Distancepart must be on the followparts table: update of followparts
# Needs filter on dpid
prereq_distonfp_fpu := distanceparts_lots sib2
# Distance can be measured between 2 individuals at most once per interval:
# insert of distanceparts
# (duplicate of distancepart_extra)
prereq_disttwice_dp := distancepart_extra
# Distance can be measured between 2 individuals at most once per interval:
# update of distances
# Needs filter, distanceparts.participant, distid
prereq_disttwice_d := distanceparts_lots
# Distances and groups
# Bug: The right way to do these is to use a follow where the kid
# is > 5 years old so as not to run into groupmembership
# requirements where both mom and kid must be in groupmembers.
# But this works for now.
# Individuals who's distance is measured must be in groupmembers:
# insert into distanceparts
# Insert KID into follow 1, 9:00 interval (but KID is not in groupmembers).
prereq_dp_in_gm_dp := groups_onemom_900 distanceparts_one
# Add one group with both the mom and the kid in the first follow, 9:00am.
# (Prerequsites take care of the mom, this just adds KID.)
prereq_groups_momkid_900 := groups_onemom_900
# Add one group with both the mom and the kid in the first follow, 9:02am.
# (Prerequsites take care of the mom, this just adds KID.)
prereq_groups_momkid902 := groups_onemom902
# Create a distanceparts pair for 9:00 for the first follow.
# Insert KID into follow 1, 9:00 interval.
prereq_distanceparts900 := groups_momkid_900 distanceparts_one
# Individuals who's distance is measured must be in groupmembers:
# update of distances
prereq_dp_in_gm_d := distanceparts900 groups_onemom902
# Individuals who's distance is measured must be in groupmembers:
# update of intervals
prereq_dp_in_gm_i := distanceparts900 groups_onemom902
# Individuals who's distance is measured must be in groupmembers:
# delete of groupmembers
prereq_dp_in_gm_gm_d := distanceparts900
# Individuals who's distance is measured must be in groupmembers:
# update of groupmembers
prereq_dp_in_gm_gm_u := distanceparts900 family2
# When the Distances.Distance value is &gmi_distunk; (99) the
# Distances.Uncertain value must be TRUE.
prereq_dp_distunk_is_true := distance_one
#
# Events
#
# The exclusive_behavior flag must be true when the restricted flag is true.
prereq_behaviors_exclude_restricted := behaviors
# behaviors.both_directions must be null when none of the
# actor or actee columns are true.
prereq_behaviors_both_directions_null := behaviors
# behaviors.both_directions must be non-null when any of the
# actor or actee columns are true.
prereq_behaviors_both_directions_non_null := behaviors
# behaviors.baboon must be null when non-focals are excluded
# from the interaction.
prereq_behaviors_baboon_null := behaviors
# behaviors.baboon must be non-null when non-focals are allowed
# in the interaction.
prereq_behaviors_baboon_non_null := behaviors
# Test the null_iff_not_true macro (against behaviors.)
# Test the null/false combo.
prereq_null_iff_not_true_nf := behaviors
# Test the null/true combo.
prereq_null_iff_not_true_nt := behaviors
# Test the true/false combo.
prereq_null_iff_not_true_tf := behaviors
# Test the true/true combo.
prereq_null_iff_not_true_tt := behaviors
# Add lots of events to the db for follows 1-4, 9:00, 10:00, 11:00
# This is just an empty file so that prerequsites are executed.
# This one has infant mom play
prereq_parts_lots := parts_mostly_prereqs parts_lots_infant_mom_play
# Add lots of dad (DAD) grooming mom events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_dad_mom_grooming := intervals_lots behaviors
# Add lots of events to the db for follows 1-4, 9:00, 10:00, 11:00
# This is just an empty file so that prerequsites are executed.
# This one has infant self play
prereq_parts_lots_i_selfplay := parts_mostly_prereqs \
parts_lots_infant_self_play
# Add lots of infant eating events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_infant_eating := intervals_lots behaviors foodkinds foodparts
# Add lots of infant grooming mom events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_infant_mom_grooming := intervals_lots behaviors
# Add lots of infant playing with mom in a directed fashion
# events to the db for follows 1-4, 9:00, 10:00, 11:00
prereq_parts_lots_infant_mom_play := intervals_lots behaviors play_types
# Add lots of infant nursing on mom (in a directed fashion)
# events to the db for follows 1-4, 9:00, 10:00, 11:00
prereq_parts_lots_infant_nursing := intervals_lots behaviors
# Add lots of infant riding on mom
# events to the db for follows 1-4, 9:00, 10:00, 11:00
prereq_parts_lots_infant_mom_rides := intervals_lots behaviors riding_postures
# Add lots of infant 'other' events for follows 1-4, 9:00, 10:00, 11:00.
prereq_parts_lots_infant_other := intervals_lots behaviors
# Add lots of infant resting events for follows 1-4, 9:00, 10:00, 11:00.
prereq_parts_lots_infant_resting := intervals_lots behaviors \
positions resting_postures
# Add lots of infant self play
# events to the db for follows 1-4, 9:00, 10:00, 11:00
prereq_parts_lots_infant_self_play := intervals_lots behaviors play_types
# Add lots of infant grooming sib events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_infant_sib_grooming := intervals_lots behaviors \
followparts_sib_noi
# Add lots of mom grooming baboon events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_mom_baboon_grooming := intervals_lots behaviors
# Add lots of mom grooming dad (DAD) events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_mom_dad_grooming := intervals_lots behaviors
# Add lots of mom eating events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_mom_eating := intervals_lots behaviors foodkinds foodparts
# Add lots of mom grooming infant events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_mom_infant_grooming := intervals_lots behaviors
# Add lots of mom playing with male (MA5) in a non-directed fashion
# events to the db for follows 1-4, 9:00, 10:00, 11:00
prereq_parts_lots_mom_ma5_play_nondirected := intervals_lots behaviors \
male5 play_types
# Add lots of mom 'other' events for follows 1-4, 9:00, 10:00, 11:00.
prereq_parts_lots_mom_other := intervals_lots behaviors
# Add lots of mom resting events for follows 1-4, 9:00, 10:00, 11:00.
prereq_parts_lots_mom_resting := intervals_lots behaviors \
positions resting_postures
# Add lots of mom grooming unknown (UNK) events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_mom_unknown_grooming := intervals_lots behaviors unk
# Add lots more of mom grooming unknown (UNK) events to the db for follows 1-4
# 9:00, 10:00, 11:00
prereq_parts_lots_mom_unknown_grooming2 := intervals_lots behaviors unk
# Just like parts_lots but with a slightly different set of intervals
# where the 9:00 interval of follow1 is on it's own sheet, sheet5.
prereq_parts_lots_after_noc_sheet := nineoclock_sheet followparts_sib_noi \
behaviors unk play_types foodkinds \
foodparts
# Add an grooming event where dad grooms mom at 9:00 in follow 1.
# Dad is, obviously, not a focal in the follow.
prereq_other_mom_grooming := intervals_lots behaviors male5
# Add an grooming event where dad grooms infant at 9:00 in follow 1.
# Dad is, obviously, not a focal in the follow.
prereq_other_grooming_infant := intervals_lots behaviors
# Add an grooming event where infant (KID) grooms dad (DAD)
# at 9:00 in follow 1.
# Dad is, obviously, not a focal in the follow.
prereq_infant_grooming_other := intervals_lots behaviors male5
# Add an event where infant (KID) plays with dad (DAD)
# as participants (non-directed) at 9:00 in follow 1.
# Dad is, obviously, not a focal in the follow.
prereq_infant_play_other_participant := intervals_lots behaviors male5 \
play_types
# Add an grooming event where sib (SIB) grooms infant (KID)
# at 9:00 in follow 1.
prereq_sib_grooms_infant := intervals_lots behaviors followparts_sib_noi
# Add a play event where sib (SIB) plays with a non-focal (DAD) in
# a non-directed way (participant) at 9:00 in follow 1.
prereq_sib_play_other_participant := intervals_lots behaviors \
followparts_sib_noi male5 play_types
# Add a eating event where the sib (SIB) eats at 9:00 in follow 1.
prereq_sib_eats := intervals_lots behaviors followparts_sib_noi foodkinds \
foodparts
# Add an grooming event where dad grooms sib at 9:00 in follow 1.
# Dad is, obviously, not a focal in the follow.
prereq_other_grooming_sib := intervals_lots behaviors male5 followparts_sib_noi
# Add an grooming event where sib grooms dad at 9:00 in follow 1.
# Dad is, obviously, not a focal in the follow.
prereq_sib_grooming_other := intervals_lots behaviors male5 followparts_sib_noi
# Add a grooming event where the mom grooms a baboon at 9:00 in follow1.
prereq_mom_grooming_baboon := intervals_lots behaviors
# An individual can participate in an event only once.
# Try to have mom be both actor and actee in grooming.
# Needs filter (pid, part)
prereq_parts_uniq_ind := intervals_first_follow followparts1 behaviors
# An individual must be on or after entrydate to be a participant in an
# event.
#
# Insert into parts. Female3 born after follow1
# Filter on pid, since using a single insert statement
prereq_parts_tooearly := intervals_first_follow followparts1 behaviors \
female3
# Update biography.
prereq_parts_tooearly_b := intervals_first_follow followparts1 behaviors \
female1
# Update follows.
prereq_parts_tooearly_f := intervals_first_follow followparts1 behaviors \
female2
# An individual must be on or before departdate to be a participant in
# an event.
#
# Insert into parts. Female5 dies before follow1
# Filter on pid, since using a single insert statement.
prereq_parts_toolate := intervals_first_follow followparts1 behaviors \
female5
# Update biography.
prereq_parts_toolate_b := intervals_first_follow followparts1 behaviors \
female1
# Update follows.
prereq_parts_toolate_f := intervals_first_follow followparts1 behaviors \
female1
#
# An event must be unique.
#
# Update of events
# Filter on (eid, participant)
prereq_event_unique_e := intervals_first_follow followparts1 behaviors
# Update of parts.
prereq_event_unique_p := intervals_first_follow followparts1 behaviors \
female1
#
# behaviors.type
# Test one 1 to many relationship and one 1 to 1 relationship.
#
# An eating event allows 1 eats row.
# Mom (MOM) eats at 9:00 in follow 1.
prereq_eats1 := eats foodkinds foodparts
# An eating event allows more than one eats row.
# Mom (MOM) eats more at 9:00 in follow 1.
prereq_eats2 := eats1
# At least one EATS row is required for an eating event.
# Insert into events without an EATS row tests events insert trigger.
# Mom (MOM) eats at 9:00 in follow 1.
prereq_eats0 := event_subtable_prereqs
# Same as eats0 but succeeds.
prereq_eats := event_subtable_prereqs
# Delete from EATS tests eats delete trigger.
prereq_eats0_d := eats1
# An eating event cannot have a RIDES row.
# Tests rides insert trigger.
prereq_eats_rides := eats riding_postures
# A riding event allows 1 rides row.
# Add RIDES row to the riding event for KID, followid 1, 9:00.
prereq_rides1 := rides riding_postures
# A rides row is required for a riding event.
# Insert into events without a RIDES row tests events insert trigger.
# Infant (KID) rides on non-focal (DAD) at 9:00 in follow 1.
prereq_rides0 := event_subtable_prereqs
# Same as rides0 but succeeds.
prereq_rides := event_subtable_prereqs
# Delete from RIDES tests rides delete trigger.
prereq_rides0_d := rides1
# A riding event does not allow more than one rides row.
# Tests events insert trigger.
# riding event for infant (KID), followid 1, 9:00.
prereq_rides2 := rides1
# A riding event cannot have an eats row.
# Tests rides insert trigger.
prereq_rides_eats := rides foodkinds foodparts
# A sample fishing event, without a fished row.
prereq_fishing := event_subtable_prereqs
# Add a fished row to the fishing event.
prereq_fishing1 := fishing foodkinds foodparts fishing_results
# Fishing events must have fishable foodparts: update foodparts
prereq_fishing_fishable_fp_u := fishing1
# Fishing events must have fishable foodparts: insert fished
prereq_fishing_fishable_fp_i := fishing foodkinds foodparts fishing_results
# Fishing events must have fishable foodkinds: update foodkinds
prereq_fishing_fishable_fk_u := fishing1
# Fishing events must have fishable foodkinds: insert fished
prereq_fishing_fishable_fk_i := fishing foodkinds foodparts fishing_results
# A sample resting event.
# Mom (MOM) rests at 9:00 in follow 1.
prereq_resting := event_subtable_prereqs resting_postures positions
# A sample play event.
# Mom (MOM) plays at 9:00 in follow 1.
prereq_plays := event_subtable_prereqs play_types
# A sample vocalization event.
# Mom (MOM) vocalizes at 9:00 in follow 1.
prereq_vocs := event_subtable_prereqs vocalizations
#
# At least one participant in an event must be a focal.
#
# Update parts, change participant
# (pif = part is focal)
prereq_pif_u_parts := parts_lots_i_selfplay
# Delete from parts
prereq_pif_d_parts := parts_lots_i_selfplay
# Update events, change interval to a different follow
prereq_pif_events := parts_lots_i_selfplay
# Put the 9:00 interval onto it's own sheet so we can play around.
prereq_nineoclock_sheet := intervals_lots five_sheets
# Update intervals, change follow
# Needs filter (behavior, parts.participant)
prereq_pif_intervals := parts_lots_after_noc_sheet
# Update followparts, change focal
# Needs filter (behavior, time, parts.participant)
# (Use to test for followparts update of behavior/parts.part combo?)
prereq_pif_followparts_u := parts_lots si2
# Delete focal from followparts
# Update followparts, delete focal
# Needs filter (behavior, time, parts.participant)
prereq_pif_followparts_d := parts_lots
#
# Tests of behaviors
#
# Update behaviors so that mom can't be the actor (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_mom_actor := parts_lots
# Update behaviors so that mom can't be the actee (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_mom_actee := parts_lots
# Update behaviors so that mom can't be a participant (play).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_mom_participant := parts_lots
# Update behaviors so that mom can't have the behavior by herself (eating).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_mom_self := parts_lots
# Update behaviors so that mom can't have a non-focal actor (grooming).
prereq_behaviors_mom_nf_actor := parts_lots other_mom_grooming
# Update behaviors so that mom can't have a non-focal actee (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_mom_nf_actee := parts_lots
# Update behaviors so that mom can't have a nonfocal participant (play).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_mom_nf_participant := parts_lots
# Update behaviors so that infant can't be the actor (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_infant_actor := parts_lots
# Update behaviors so that infant can't be the actee (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_infant_actee := parts_lots
# Update behaviors so that infant can't be a participant (play).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_infant_participant := parts_lots infant_play_other_participant
# Update behaviors so that infant can't have the behavior by herself (eating).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_infant_self := parts_lots
# Update behaviors so that infant can't have a non-focal actor (grooming).
prereq_behaviors_infant_nf_actor := parts_lots other_grooming_infant
# Update behaviors so that infant can't have a non-focal actee (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_infant_nf_actee := parts_lots infant_grooming_other
# Update behaviors so that infant can't have a nonfocal participant (play).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_infant_nf_participant := parts_lots \
infant_play_other_participant
# Update behaviors so that sib can't be the actor (grooming).
prereq_behaviors_sib_actor := parts_lots sib_grooms_infant
# Update behaviors so that sib can't be the actee (grooming).
# Needs filter: follows.date, mother, time, baboon, participant
prereq_behaviors_sib_actee := parts_lots
# Update behaviors so that sib can't be a participant (play).
prereq_behaviors_sib_participant := parts_lots sib_play_other_participant
# Update behaviors so that sib can't have the behavior by herself (eating).
prereq_behaviors_sib_self := parts_lots sib_eats
# Update behaviors so that sib can't have a non-focal actor (grooming).
prereq_behaviors_sib_nf_actor := parts_lots other_grooming_sib
# Update behaviors so that sib can't have a non-focal actee (grooming).
prereq_behaviors_sib_nf_actee := parts_lots sib_grooming_other
# Update behaviors so that sib can't have a nonfocal participant (play).
prereq_behaviors_sib_nf_participant := parts_lots \
sib_play_other_participant
# Update behaviors so that a baboon cannot participate.
# Needs filter (mother, time, date, participant, part)
prereq_behaviors_mom_baboon := parts_lots mom_grooming_baboon
# Test that parts obeys the columns on behaviors having to do with
# actor, actee, participant, self, nf_actor, nf_actee, nf_participant.
# Do updates so there's no worries about events/parts trigger order.
# Update parts: mom is not supposed to be an actor.
# Eating event for mom (MOM) at 9:00 in follow1
prereq_parts_mom_actor := parts_lots
# Update parts: mom is not supposed to be an actee.
# Eating event for mom (MOM) at 9:00 in follow 1.
prereq_parts_mom_actee := parts_lots
# Update parts: mom is not supposed to be a participant
# Eating event for mom (MOM) at 9:00 in follow 1.
prereq_parts_mom_participant := parts_lots
# Update parts: mom is not supposed to be self.
# Change riding event for mom (MOM) so mom is self at 9:00 in follow 1.
prereq_parts_mom_self := parts_lots parts_lots_infant_mom_rides
# Update parts: mom is not supposed to have an actor nonfocal partner.
# First change play to not allow nonfocal mom partner to be actor,
# then change mom non-directed play with ma5 so ma5 is actor.
prereq_parts_mom_nf_actor := parts_lots_mom_ma5_play_nondirected
# Update parts: mom is not supposed to have an actee nonfocal partner.
# First change play to not allow nonfocal mom partner to be actee,
# then change mom non-directed play with ma5 so ma5 is actee.
prereq_parts_mom_nf_actee := parts_lots_mom_ma5_play_nondirected
# Test that events obeys the columns on behaviors having to do with
# actor, actee, participant, self, nf_actor, nf_actee, nf_participant.
# Do updates so there's no worries about events/parts trigger order.
# Update events: mom is not supposed to be an actor.
# Change mom grooming infant event to an other event.
prereq_events_mom_actor := parts_lots
# Update events: mom is not supposed to be an actee.
# Change infant grooming mom event to an other event.
prereq_events_mom_actee := parts_lots
# Update events: mom is not supposed to be a participant.
# Change mom playing with MA5 in a non-directed way event to an other event.
prereq_events_mom_participant := parts_lots
# Update events: mom is not supposed to be a non-social participant "self".
# Change mom eating to a begging event.
prereq_events_mom_self := parts_lots
# Update events: mom is not supposed to have an actor nonfocal partner.
# First make 'other' allow mom to be actee,
# then change dad grooming mom to be an "other" behavior.
prereq_events_mom_nf_actor := parts_lots parts_lots_dad_mom_grooming
# Update events: mom is not supposed to have an actee nonfocal partner.
# First make 'other' allow mom to be actor,
# then change mom grooming dad to be an "other" behavior.
prereq_events_mom_nf_actee := parts_lots parts_lots_dad_mom_grooming
# Update events: mom is not supposed to be with a nonfocal participant.
# Change mom playing with MA5 in a non-directed way event to an other event.
prereq_events_mom_nf_participant := parts_lots
# Test of behaviors.position.
# Update behaviors so that position is required.
# Needs filter: date, mother, time, baboon, participant
prereq_behaviors_position_true := parts_lots
# Update behaviors so that position must be null.
prereq_behaviors_position_false := resting
# Insert a resting event that does not have the right position value.
prereq_events_position := event_subtable_prereqs resting_postures positions
# Cardnality and proper actor/actee, participant/participant event tests.
# Insert an event without a related parts row.
prereq_events_no_parts := event_subtable_prereqs
# Insert an event with 3 related parts rows.
# A play event, with MOM, KID, and DAD; test events trigger.
# Needs filter: (eid, participant)
prereq_events_3_parts := parts_lots male5
# Baboons must play with a single chimp.
# A play event, with MOM, KID and a baboon; test events trigger.
# Needs filter: (eid, participant)
prereq_events_2_parts_baboon := parts_lots
# Insert a parts row to give an event 3 related parts rows; test parts insert.
# A play event, add DAD to existing MOM, KID for follow 1, 9:00.
prereq_parts_3_parts := parts_lots male5
# Delete a parts row to give an event 1 related parts rows; test parts delete.
# Delete KID from the MOM/KID play event for follow 1, 9:00.
prereq_parts_1_part := parts_lots
# Changing a play event with MOM & KID to MOM baboon is legal, follow 1, 9:00.
prereq_parts_1_part_baboon := parts_lots
# A 'self' behavior can have only one parts row.
# Try putting 2 parts rows into a eating event for SIB & KID
# at 9:00 in follow 1.
prereq_parts_2_self := parts_lots
# A 'self' behavior cannot involve a baboon; update parts.
# Take the MOM/baboon grooming event at 9:00 for follow 1 and change
# MOM's part to 'self'.
prereq_parts_self_baboon := parts_lots
# A 'self' behavior cannot involve a baboon; insert events.
# Insert a self play event for a sibling (SIB) at 9:00 for follow 1
# and have it be with a baboon.
prereq_events_self_baboon := parts_lots
# Actors must have a corresponding actee; update of parts
# Change mom (MOM) grooming infant (KID) at 9:00 in follow 1 to
# two actors.
prereq_parts_actor_actor := parts_lots
# Actors must have a cooresponding actee: delete of parts
# (Error says must have 2 participants, which satisfies the
# test since adding a 2nd parts row will validate the new row.)
# Delete infant in mom (MOM) grooming infant (KID) in follow1 at 9:00.
prereq_parts_actor_actor_d := parts_lots
#
# Actors need not have a corresponding actee when a baboon is involved.
# This case is tested for by parts_lots, which inserts just such a row.
#
# Actors must have a corresponding actee; update of parts
# Change mom (MOM) grooming infant (KID) at 9:00 in follow 1 to
# two actees.
prereq_parts_actee_actee := parts_lots
# Participants (P) must have a cooresponding participant: update of parts
# Change infant to P in infant plays with mom (actor/actee) at 9:00
# of follow 1.
prereq_parts_participant_participant := parts_lots
# Participant (P) must have a corresponding participant, unless
# baboon is involved: update of parts
# Have KID play with a baboon in a non-directed fashion at 9:00 in follow 1.
prereq_parts_participant_baboon := parts_lots
# A non-social (self) interaction cannot happen to an individual at
# the same time as a non-directed (participant) interaction.
# Insert infant (KID) self-play into 9:00 of follow 1 when the
# infant is already playing with the dad in a non-directed fashion.
# (Note we don't really need the parts_lots.)
prereq_self_participant_play := parts_lots infant_play_other_participant
# Directed behaviors are not allowed to be reciprocal.
# (parts_lots already puts in reciprocal grooming behaviors for mom/kid
# so we know the error message isn't spuriously triggered.)
#
# Update behaviors, set grooming to be non-reciprocal.
# Needs filter: date, mother, time, participant, part
prereq_behaviors_both_directions := parts_lots
# Insert into parts, have mom (MOM) play with infant (KID) in a
# directed fashion when the infant is already playing with the mom
# in a directed fashion.
# Needs filter: pid, participant, part
prereq_parts_both_directions := parts_lots
# Update events, change from grooming to play so that the mom (MOM)
# is playing with the infant (KID) in a directed fashion when the infant
# is already playing with the mom in a directed fashion.
# At 9:00 in follow 1.
# Needs filter: pid (except pid is not displayed), participant, part
prereq_events_both_directions := parts_lots
# Behaviors restricted/exclusive.
#
# The really safe thing to do, which isn't done, is before
# testing mom-or-not exclusive/restricted to update the behaviors
# table so that the not-or-mom columns are all false. This would
# check for using the wrong column in the trigger code.
#
# behaviors
# Update behaviors so grooming is restricted.
# Needs filter: date, mother, time, baboon, participant, part
prereq_behaviors_restricted := parts_lots
# Update behaviors so 'other' is excluded.
# Needs filter: date, mother, time, baboon, participant, part
prereq_behaviors_exclusive := parts_lots_infant_resting \
parts_lots_infant_other
# Update behaviors so grooming is mom_restricted.
# Needs filter: date, mother, time, baboon, participant, part
prereq_behaviors_mom_restricted := parts_lots
# Update behaviors so "other" is mom exclusive.
# Needs filter: date, mother, time, baboon, participant, part
prereq_behaviors_mom_exclusive := parts_lots_mom_resting \
parts_lots_mom_other
# Restricted/Exclusive conditions do not apply when everything is uncertain.
# (Note, not testing restricted/exclusive regards moms.)
# Make every event uncertain, then change grooming to restricted.
prereq_behaviors_er_uncertain := parts_lots
# Restricted/exclusive conditions do not apply to actees.
# (Note, not testing regards infant/sib.)
# Make play restricted.
prereq_behaviors_er_actee := parts_lots_infant_mom_play \
parts_lots_mom_infant_grooming
#
# parts
# Insert parts, of restricted behavior.
# Insert a infant resting behavior when there's other exclusive behaviors
# already.
prereq_parts_restricted := parts_lots positions resting_postures
# Insert parts, an exclusive behavior.
# Insert an infant eating behavior when there's an other (resting)
# restricted behavior.
prereq_parts_exclusive := parts_lots_infant_resting foodkinds foodparts
# Insert parts, a mom restricted behavior.
# Insert a mom resting behavior when there's other exclusive behaviors.
prereq_parts_mom_restricted := parts_lots positions resting_postures
# Insert parts, a mom exclusive behavior.
# Insert a mom eating beahvior when there's an other (resting)
# restricted behavior.
prereq_parts_mom_exclusive := parts_lots_mom_resting foodkinds foodparts
# Restricted/Exclusive conditions do not apply when everything is uncertain.
# (Note, not testing restricted/exclusive regards moms.)
# Make every event uncertain, then add an uncertain resting event
# to follow 1 at 9:00.
prereq_parts_er_uncertain := parts_lots resting_postures positions
# Restricted/exclusive conditions do not apply to actees.
# (Note, not testing regards infant/sib.)
# Insert mom resting when there's infant grooming mom events.
prereq_parts_er_actee := parts_lots_infant_mom_grooming \
resting_postures positions
#
# events
# Update events changing behavior from eating to resting (a restricted
# behavior) when there are already exclusive behaviors
# for infant (KID) at 9:00 in follow 1.
prereq_events_restricted := parts_lots positions resting_postures
# Update events changing behavior from other to eating (an exclusive
# behavior) when there is already a resticted behavior (resting)
# for infant (KID) at 9:00 in follow 1
prereq_events_exclusive := parts_lots_infant_resting parts_lots_infant_other \
foodparts foodkinds
# Update events changing mom behavior from eating to resting (a restricted
# behavior) when there are already mom exclusive behaviors
# for mom (MOM) at 9:00 in follow 1.
prereq_events_mom_restricted := parts_lots positions resting_postures
# Update events changing mom behavior from other to eating (an exclusive
# behavior) when there is already a mom resticted behavior (resting)
# for mom (MOM) at 9:00 in follow 1
prereq_events_mom_exclusive := parts_lots_mom_resting \
parts_lots_mom_other foodparts foodkinds
# Restricted/Exclusive conditions do not apply when everything is uncertain.
# (Note, not testing restricted/exclusive regards moms.)
# Make every event uncertain, then update events changing eating to
# resting (a restricted behavior) for infant (KID) in
# follow 1 at 9:00.
prereq_events_er_uncertain := parts_lots resting_postures positions
# Restricted/exclusive conditions do not apply to actees.
# (Note, not testing regards infant/sib.)
# Update events changing mom behavior from eating to resting (a restricted
# behavior) when there are already mom as an actee exclusive behaviors
# for mom (MOM) at 9:00 in follow 1.
prereq_events_er_actee := parts_lots_infant_mom_grooming \
parts_lots_mom_eating positions resting_postures
#
# Views
#
# focal_follows
# Test insert into focalfollows, with sibling
# Also test that inserting returns the inserted row.
prereq_ff_insert := demography sib followroles
# A follow must have an interval to successfully commit.
prereq_ff_interval := ff_insert sheets
# Prove that the rows actually went in.
prereq_ff_insert_out := ff_interval
# Test insert into focalfollows, without sibling
prereq_ff_insert1 := demography sib followroles
# A follow must have an interval to successfully commit.
# (Same as ff_interval, with different prereq.)
prereq_ff_interval1 := ff_insert1 sheets
# Prove that the rows actually went in.
# (Same as ff_insert_out, with different prereq.)
prereq_ff_insert1_out := ff_interval1
# Test update of focal_follows, updating date.
prereq_ffu_date := ff_interval
# (Code is the same as the ff_insert_out code, results differ.)
prereq_ffu_date_out := ffu_date
# Test update of focal_follows, updating mom.
prereq_female4_adopt := demography female4
prereq_ffu_mom := ff_interval1 female4_adopt
# (Code is the same as the ff_insert_out code, results differ.)
prereq_ffu_mom_out := ffu_mom
# Test update of focal_follows, inserting sib.
prereq_ffu_newsib := ff_interval1
# (Code is the same as the ff_insert_out code, results differ.)
prereq_ffu_newsib_out := ffu_newsib
# Test update of focal_follows, deleting sib.
prereq_ffud := ff_interval
# (Code is the same as the ff_insert_out code, results differ.)
prereq_ffud_out := ffud
# Test delete of focal_follows.
prereq_ff_delete := ff_interval
prereq_ff_delete_out := ff_delete
# Test display of twins.
# (Code is the same as the ff_insert_out code, results differ.)
prereq_ff_twins_out := followparts_twins
# follow_intervals
# Simple test of view output
prereq_fi_out := intervals
# Insert with followid (also inserts new sheet and new fieldfollow)
# Test also checks that INSERT ... RETURNING returns what's in the db.
prereq_fi_i_followid := ff_insert followtypes people
# Insert with date/mom/infant
prereq_fi_i_dmi := ff_insert followtypes people
# Insert with existing sheet
## Insert with sheetid
prereq_fi_i_sheetid := ff_insert sheets
## Insert with page number
prereq_fi_i_page := ff_insert sheets
# Insert with existing fieldfollow
## Insert with ffid
prereq_fi_i_ffid := ff_insert fieldfollows1
## Insert with collector (This inserts a 2nd event.)
prereq_fi_i_collector := fi_i_followid
# Update the interval time
prereq_fi_u_time := fi_i_dmi
# Delete an interval.
prereq_fi_d := fi_i_collector
# Test of not being able to update a non-updatable column.
# Try to update the date.
prereq_fi_error := fi_i_dmi
# family_events
# Simple test of family_events output
# (Should probably have a different prerequsite with fewer rows.)
prereq_fe_out := parts_lots
# Insert by intid
# Insert a single mom self-grooming event.
# Also test that INSERT ... RETURNING ... returns what's in the db.
prereq_fe_i_intid := fi_i_followid behaviors
# Insert by date, mom, infant, time.
prereq_fe_i_dmit := fi_i_followid behaviors
# Insert by followid, time.
prereq_fe_i_ft := fi_i_followid behaviors
# Insert by date, mom, infant, time when there's lots of parts.
# Add a mom self-grooming to 9:00 follow1.
prereq_fe_i_lots := parts_lots
# Update change behavior.
# Change self self-grooming to self-other for mom.
prereq_fe_u_behavior := fe_i_intid
# Update change participant
## Change chimpid in place
## Change MOM to KID
prereq_fe_u_chimpid := fe_i_intid
## Delete old parts row add new.
## Also tests for returning of db content.
prereq_fe_u_oldtonew := fe_i_intid
# Delete
prereq_fe_d := fe_i_intid
# Datasheet_events
# Simple test of datasheet_events output
# (Should probably have a different prerequsite with fewer rows.)
prereq_de_out := parts_lots
# Insert by intid
# Insert a single mom self-grooming event.
# Also test that INSERT ... RETURNING ... returns what's in the db.
prereq_de_i_intid := fi_i_followid behaviors
# Insert a mom eating event, using an intid.
prereq_de_i_eats := fi_i_followid behaviors foodparts foodkinds
# Insert a 2nd mom eating food for an existing eating event.
prereq_de_i_eats2 := de_i_eats
# Insert a mom fishing event, using an intid.
prereq_de_i_fished := fi_i_followid behaviors \
foodparts foodkinds fishing_results
# Insert a mom play event, using an intid.
prereq_de_i_plays := fi_i_followid behaviors play_types
# Insert a 2nd mom play type for an existing play event.
prereq_de_i_plays2 := de_i_plays
# Insert a mom rest event, using an intid.
prereq_de_i_rests := fi_i_followid behaviors resting_postures positions
# Insert an infant ride event, using an intid.
prereq_de_i_rides := fi_i_followid behaviors riding_postures
# Insert a mom vocalization event, using an intid.
prereq_de_i_vocs := fi_i_followid behaviors vocalizations
# Insert a second vocalization for an existing vocalization event.
prereq_de_i_vocs2 := de_i_vocs
# Insert by date, mom, infant, time when there's lots of parts.
# Add a mom food to eating event at 9:00 follow1.
prereq_de_i_lots := parts_lots
# Update change behavior.
# Change self self-grooming to self-other for mom.
# Also tests that update returns what's in the db.
prereq_de_u_behavior := de_i_intid
# Change a mom's vocalization code from HOO to GR.
prereq_de_u_vocs := de_i_vocs
# Delete one of a mom's two vocalizations.
prereq_de_u_vocs2 := de_i_vocs2
# Change a mom's eating foodpart and foodkind from M,B to V,L
prereq_de_u_eats := de_i_eats
# Delete one of a mom's 2 eaten foods.
prereq_de_u_eats2 := de_i_eats2
# Change a mom's fishing foodkind from B to F
prereq_de_u_fished := de_i_fished
# Change a mom's play code from OP to TP
prereq_de_u_plays := de_i_plays
# Delete one of a mom's 2 play types
prereq_de_u_plays2 := de_i_plays2
# Change a mom's rest code
prereq_de_u_rests := de_i_rests
# Change an infant's ride code
prereq_de_u_rides := de_i_rides
# Update to insert eating foodpart
prereq_de_u_eats_i := de_i_intid foodkinds foodparts
# Update to insert fishing foodtype
prereq_de_u_fished_i := de_i_intid foodkinds foodparts fishing_results
# Update to insert resting posture
prereq_de_u_rests_i := de_i_intid positions resting_postures
# Update to insert riding posture
# (needs to use a infant grooming mom as a starting point)
prereq_de_u_rides_i := parts_lots riding_postures
# Update to insert play type
prereq_de_u_plays_i := de_i_intid play_types
# Update to insert vocalization
prereq_de_u_vocs_i := de_i_intid vocalizations
# Delete
prereq_de_d := de_i_intid
# family_dists
# Simple test of family_dists output
# (Should probably have a different prerequsite with fewer rows.)
prereq_fd_out := distanceparts_lots
# Insert by intid
# Insert a single mom-infant distance, using intid.
# Also tests to be sure INSERT ... RETURNING returns what's in the db.
prereq_fd_i_intid := fi_i_followid distancecodes
# Insert by date, mom, infant, time.
prereq_fd_i_dmit := fi_i_followid distancecodes
# Insert by followid, time.
prereq_fd_i_ft := fi_i_followid distancecodes
# Insert by followid and time, a mom and a sib.
prereq_fd_i_ft_mom_sib := fi_i_followid distancecodes
# Update change distance.
# Change mom/infant distance.
prereq_fd_u_distance := fd_i_intid
# Update change participant
## Change chimpid in place
## Change KID to SIB
prereq_fd_u_chimpid := fd_i_intid
## Delete old distanceparts row add new.
## Also tests to see that db content is returned properly.
prereq_fd_u_oldtonew := fd_i_intid
# Delete
prereq_fd_d := distanceparts_lots
# Insert by date, mom, infant, time when there's lots of parts.
# Add a mom self-grooming to 9:00 follow1.
prereq_fd_i_lots := fd_d
#
# Warning system
#
# integrity_queries
# Normal integrity query (warns on birthdates before 1960)
prereq_iq_i := iqtypes
# A integrity_query.iqname of an empty string is illegal.
prereq_iq_i_notempty := iqtypes
# A integrity_query.iqname cannot contain a space.
prereq_iq_i_nospace := iqtypes
# A integrity_query.iqname cannot change.
prereq_iq_u_iqname := iq_i
# An integrity query cannot be run most recently before it was run first.
prereq_iq_u_last_early := iq_i
# integrity_warnings
prereq_iw_i := iq_i
# An integrity warning cannot be seen most recently before it was first seen.
prereq_iw_u_last_early := iw_i
# An integrity warning cannot be resolved before it was first seen.
prereq_iw_u_resolved_early := iw_i
# An integrity warning cannot be deferred to a time before it was first seen.
prereq_iw_u_deferred_early := iw_i
# Combination tests
# Warnings can be resolved.
prereq_iw_u_resolve := iw_i
# Errors can be made into warnings when there's no resolution
# (Same as iq_resolve_errors, only with different pre-requsites.)
prereq_iq_u_make_error := iw_i
# Warnings cannot be resolved, update of integrity_queries
prereq_iq_u_resolve_errors := iw_u_resolve
# Warnings cannot be resolved, update of integrity_warnings
# (Same as iw_u_resolve, only with different pre-requsites.)
prereq_iw_u_resolve_errors := iq_u_make_error
# Tests of the functions
# Query supplied to command fails
# riq_badarg (No prerequsite)
# Query supplied to command returns invalid iqname
prereq_riq_bad_iqname := iq_i
# Query saved in integrity_queries fails
prereq_iq_i_bad := iqtypes
prereq_riq_bad_squery := iq_i_bad
# Running 1 query works and finds the right results
prereq_riq_1_results := iq_i demography
# Insert an additional saved query
prereq_iq_i2 := iqtypes
# Running 2 queries work
# (This is the same code riq_1_results, only with different pre-requsites.)
prereq_riq_2_results := iq_i iq_i2 demography
# Running 2 queries updates result timestamps
prereq_riq_every_rtimestamp := riq_2_results
# Running query updates saved query timestamp
prereq_riq_every_stimestamp := riq_2_results
# Running 1 query after running 2 that find problems updates only the
# saved query timestamp for the 2nd run.
prereq_riq_one_stimestamp := riq_2_results
# Resolved warnings are not returned
prereq_riq_resolved := riq_2_results
# Warnings deferred to the future are not returned.
prereq_riq_future := riq_2_results
# Warnings deferred to the past are returned.
prereq_riq_past := riq_2_results
# When problem goes away the integrity_warnings row is removed
prereq_riq_no_problem := riq_1_results
# Prerequesites that exist only to give names to prerequsite collections.
# (Targets can have any name.
# These targets must be added to VIRTUAL_PREREQS.)
VIRTUAL_PREREQS := \
adoptions_prereqs \
follow_prereqs \
intervals_prereqs \
followpart_basic_prereqs \
followpart_prereqs \
followparts_amom_prereqs \
intervals_lots_day1 \
event_subtable_prereqs \
parts_mostly_prereqs \
five_sheets
adoptions_prereqs := male3 family2
follow_prereqs := people
intervals_prereqs := sheets_second follows2_data follows3_data
followpart_basic_prereqs := followroles follow_prereqs
followpart_prereqs := followpart_basic_prereqs demography family2
followparts_amom_prereqs := followparts13 adoptions3 follows1_data \
follows4_data intervals_fourth_follow \
intervals_third_follow intervals_first_follow \
followparts2 intervals
intervals_lots_day1 := intervals_lots_follow1 intervals_lots_follow2
event_subtable_prereqs := intervals_first_follow followparts1 behaviors
parts_mostly_prereqs := \
parts_lots_infant_eating \
parts_lots_infant_mom_grooming \
parts_lots_infant_nursing \
parts_lots_infant_sib_grooming \
parts_lots_mom_baboon_grooming \
parts_lots_mom_dad_grooming \
parts_lots_mom_eating \
parts_lots_mom_infant_grooming \
parts_lots_mom_ma5_play_nondirected \
parts_lots_mom_unknown_grooming \
parts_lots_mom_unknown_grooming2 \
# Get all sheets up to 5.
five_sheets := sheets_fourth sheets_fifth
###############
# Internals
# 'commit' need not have a prerequisite, but then it won't succeed
# should it be run as an independent test.
prereq_commit := begin