From c5a0c3d3dfa31267af3f0cd986ba8725d00a2bdc Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 27 May 2026 19:07:02 +0000 Subject: [PATCH] Create, document, index, and trigger ATTENDANCE --- db/schemas/lib/triggers/Makefile | 3 +- db/schemas/lib/triggers/create/attendance.m4 | 98 ++++++ .../lib/triggers/create/biography_data.m4 | 80 ++++- db/schemas/lib/triggers/drop/attendance.m4 | 23 ++ db/schemas/sokwedb/indexes/Makefile | 2 +- .../sokwedb/indexes/create/attendance.m4 | 40 +++ db/schemas/sokwedb/indexes/drop/attendance.m4 | 29 ++ db/schemas/sokwedb/tables/Makefile | 3 +- .../sokwedb/tables/create/attendance.m4 | 60 ++++ doc/src/epilog.inc.m4 | 29 ++ doc/src/tables.m4 | 1 + doc/src/tables/attendance.m4 | 285 ++++++++++++++++++ include/global_constants.m4 | 9 + include/limits.m4 | 3 + 14 files changed, 660 insertions(+), 5 deletions(-) create mode 100644 db/schemas/lib/triggers/create/attendance.m4 create mode 100644 db/schemas/lib/triggers/drop/attendance.m4 create mode 100644 db/schemas/sokwedb/indexes/create/attendance.m4 create mode 100644 db/schemas/sokwedb/indexes/drop/attendance.m4 create mode 100644 db/schemas/sokwedb/tables/create/attendance.m4 create mode 100644 doc/src/tables/attendance.m4 diff --git a/db/schemas/lib/triggers/Makefile b/db/schemas/lib/triggers/Makefile index 5b73741..9265fe2 100644 --- a/db/schemas/lib/triggers/Makefile +++ b/db/schemas/lib/triggers/Makefile @@ -37,7 +37,8 @@ ORDER := comm_ids \ sightings \ food_events \ groomings \ - groom_scans + groom_scans \ + attendance DROP_EXISTING := true diff --git a/db/schemas/lib/triggers/create/attendance.m4 b/db/schemas/lib/triggers/create/attendance.m4 new file mode 100644 index 0000000..d66df11 --- /dev/null +++ b/db/schemas/lib/triggers/create/attendance.m4 @@ -0,0 +1,98 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify it +dnl under the terms of the GNU Affero General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Triggers for the biography_data table +dnl +dnl Karl O. Pinc + +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`macros.m4')dnl + + +RAISE INFO 'attendance_func'; +CREATE OR REPLACE FUNCTION attendance_func () + RETURNS trigger + LANGUAGE plpgsql + sdb_function_set_search_path + AS $$ + BEGIN + -- Function for attendance insert and update triggers + -- + -- AGPL_notice(` --', `2026', + `The Meme Factory, Inc., www.karlpinc.com') + + IF TG_OP = 'UPDATE' THEN + cannot_change(`ATTENDANCE', `AtID') + END IF; + + -- An individual censused at the feeding station must be under study. + -- (Maybe this should be 2 different tests and 2 error messages + -- to make it easy on the user's brain, like we do everywhere else? + -- But this is less code.) + IF TG_OP = 'INSERT' + OR NEW.date <> OLD.date THEN + DECLARE + a_entrydate biography_data.entrydate%TYPE; + a_departdate biography_data.departdate%TYPE; + + BEGIN + SELECT biography_data.entrydate, biography_data.departdate + INTO a_entrydate , a_departdate + FROM biography_data + WHERE NEW.date < biography_data.entrydate + OR NEW.date > biography_data.departdate; + IF FOUND THEN + RAISE EXCEPTION integrity_constraint_violation USING + MESSAGE = 'Error on ' || TG_OP || ' of ATTENDANCE' + , DETAIL = 'An individual may not be censused at the feeding' + || ' station unless the individual is under study,' + || ' the ATTENDANCE.Date cannot be before' + || ' BIOGRAPHY_DATA.EntryDate or after' + || ' BIOGRAPHY_DATA.DepartDate' + || ': Key (AtID) = (' + || NEW.atid + || '), Value (AnimID) = (' + || NEW.animid + || '), Value (Date) = (' + || NEW.date + || '), Value (Start) = (' + || NEW.start + || '), Key (Stop) = (' + || NEW.stop + || '), Value (CommID) = (' + || NEW.commid + || '), Value (CommID) = (' + || NEW.commid + || '), Value (BIOGRAPHY_DATA.EntryDate) = (' + || a_entrydate + || '), Value (BIOGRAPHY_DATA.DepartDate) = (' + || a_departdate + || ')'; + END IF; + END; + END IF; + + RETURN NULL; + END; +$$; + + +RAISE INFO 'attendance_trigger'; +CREATE TRIGGER attendance_trigger + AFTER INSERT OR UPDATE + ON attendance FOR EACH ROW + EXECUTE PROCEDURE attendance_func(); diff --git a/db/schemas/lib/triggers/create/biography_data.m4 b/db/schemas/lib/triggers/create/biography_data.m4 index 46494cb..cbd683e 100644 --- a/db/schemas/lib/triggers/create/biography_data.m4 +++ b/db/schemas/lib/triggers/create/biography_data.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2023, 2024, 2025 The Meme Factory, Inc. +dnl Copyright (C) 2023, 2024, 2025, 2026 The Meme Factory, Inc. dnl http://www.karlpinc.com/ dnl dnl This program is free software: you can redistribute it and/or modify it @@ -497,7 +497,83 @@ CREATE OR REPLACE FUNCTION biography_data_func () END IF; END; - -- ROLES + -- ATTENDANCE + DECLARE + a_atid attendance.atid%TYPE; + a_date attendance.date%TYPE; + a_start attendance.start%TYPE; + a_stop attendance.stop%TYPE; + a_commid attendance.commid%TYPE; + + BEGIN + -- Cannot have a record of being at the feeding station before + -- the individual was studied. + IF NEW.entrydate <> OLD.entrydate THEN + SELECT attendance.atid, attendance.date, attendance.start + , attendnance.stop, attendance.commid + INTO a_atid , a_date , a_start + , a_stop , a_commid + FROM attendance + WHERE attendance.animid = NEW.animid + AND attendance.date < NEW.entrydate + ORDER BY attendance.date, attendance.start; -- consistency + IF FOUND THEN + RAISE EXCEPTION integrity_constraint_violation USING + MESSAGE = 'Error on UPDATE of BIOGRAPHY_DATA' + , DETAIL = 'An individual cannot be at the feeding station' + || ' before they are under study' + || ': Key (Animid) = (' + || NEW.animid + || '), Value (EntryDate) = (' + || NEW.entrydate + || ': Key (ATTENDANCE.AtID) = (' + || a_atid + || '), Value (ATTENDANCE.Date) = (' + || a_date + || '), Value (ATTENDANCE.Start) = (' + || a_start + || '), Value (ATTANDANCE.Stop) = (' + || a_stop + || '), Value (ATTANDANCE.Commid) = (' + || a_commid + || ')'; + END IF; + END IF; + + IF NEW.departdate <> OLD.departdate THEN + SELECT attendance.atid, attendance.date, attendance.start + , attendnance.stop, attendance.commid + INTO a_atid , a_date , a_start + , a_stop , a_commid + FROM attendance + WHERE attendance.animid = NEW.animid + AND attendance.date < NEW.departdate + ORDER BY attendance.date, attendance.start; -- consistency + IF FOUND THEN + RAISE EXCEPTION integrity_constraint_violation USING + MESSAGE = 'Error on UPDATE of BIOGRAPHY_DATA' + , DETAIL = 'An individual cannot be at the feeding station' + || ' before they are under study' + || ': Key (Animid) = (' + || NEW.animid + || '), Value (DepartDate) = (' + || NEW.departdate + || ': Key (ATTENDANCE.AtID) = (' + || a_atid + || '), Value (ATTENDANCE.Date) = (' + || a_date + || '), Value (ATTENDANCE.Start) = (' + || a_start + || '), Value (ATTANDANCE.Stop) = (' + || a_stop + || '), Value (ATTANDANCE.Commid) = (' + || a_commid + || ')'; + END IF; + END IF; + END; + +-- ROLES DECLARE -- ROLES diff --git a/db/schemas/lib/triggers/drop/attendance.m4 b/db/schemas/lib/triggers/drop/attendance.m4 new file mode 100644 index 0000000..543ab85 --- /dev/null +++ b/db/schemas/lib/triggers/drop/attendance.m4 @@ -0,0 +1,23 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc. http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published by +dnl the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Drop triggers for attendance table +dnl +dnl Karl O. Pinc + +dnl m4 includes +include(`copyright.m4')dnl + +DROP FUNCTION IF EXISTS attendance_func() CASCADE; diff --git a/db/schemas/sokwedb/indexes/Makefile b/db/schemas/sokwedb/indexes/Makefile index 11a3cea..df9125a 100644 --- a/db/schemas/sokwedb/indexes/Makefile +++ b/db/schemas/sokwedb/indexes/Makefile @@ -22,7 +22,7 @@ ORDER := biography_data biography_log comm_membs comm_memb_log \ follows follow_observers follow_studies events roles arrivals \ estrus_sources estrus_states aggression_event_log sightings \ - aggressions food_events groomings groom_scans + aggressions food_events groomings groom_scans attendance ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/sokwedb/indexes/create/attendance.m4 b/db/schemas/sokwedb/indexes/create/attendance.m4 new file mode 100644 index 0000000..d3c00cf --- /dev/null +++ b/db/schemas/sokwedb/indexes/create/attendance.m4 @@ -0,0 +1,40 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +CREATE INDEX IF NOT EXISTS attendance_animid ON attendance + (animid); +CREATE INDEX IF NOT EXISTS attendance_date ON attendance + (date); +CREATE INDEX IF NOT EXISTS attendance_start ON attendance + (start); +CREATE INDEX IF NOT EXISTS attendance_stop ON attendance + (stop); +CREATE INDEX IF NOT EXISTS attendance_commid ON attendance + (commid); +CREATE INDEX IF NOT EXISTS attendance_swelling ON attendance + (swelling); + +-- Don't index ArrivalDegree, DepartureDegree, Recorder, Observer2 +-- because we don't expect to search on them. + + diff --git a/db/schemas/sokwedb/indexes/drop/attendance.m4 b/db/schemas/sokwedb/indexes/drop/attendance.m4 new file mode 100644 index 0000000..8b49dc6 --- /dev/null +++ b/db/schemas/sokwedb/indexes/drop/attendance.m4 @@ -0,0 +1,29 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`indexmacros.m4')dnl + +DROP INDEX IF EXISTS attendance_animid; +DROP INDEX IF EXISTS attendance_date; +DROP INDEX IF EXISTS attendance_start; +DROP INDEX IF EXISTS attendance_stop; +DROP INDEX IF EXISTS attendance_commid; +DROP INDEX IF EXISTS attendance_swelling; diff --git a/db/schemas/sokwedb/tables/Makefile b/db/schemas/sokwedb/tables/Makefile index aeb15a9..c05f1e1 100644 --- a/db/schemas/sokwedb/tables/Makefile +++ b/db/schemas/sokwedb/tables/Makefile @@ -40,7 +40,8 @@ ORDER := biography_data \ non_brec_sighting_sources \ food_events \ groomings \ - groom_scans + groom_scans \ + attendance ## ## CAUTION: This Makefile is not designed to be run directly. It is normally ## invoked by another Makefile. diff --git a/db/schemas/sokwedb/tables/create/attendance.m4 b/db/schemas/sokwedb/tables/create/attendance.m4 new file mode 100644 index 0000000..21dfa34 --- /dev/null +++ b/db/schemas/sokwedb/tables/create/attendance.m4 @@ -0,0 +1,60 @@ +dnl Copyright (C) 2026 The Meme Factory, Inc., http://www.karlpinc.com/ +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU Affero General Public License as published +dnl by the Free Software Foundation, either version 3 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU Affero General Public License for more details. +dnl +dnl You should have received a copy of the GNU Affero General Public License +dnl along with this program. If not, see . +dnl +dnl Karl O. Pinc +dnl +dnl +dnl m4 includes +include(`copyright.m4')dnl +include(`constants.m4')dnl +include(`tablemacros.m4')dnl +include(`grants.m4')dnl +dnl + +CREATE TABLE attendance ( + key_column(`ATTENDANCE', `AtID', INTEGER) + ,animid_column(`animid', `AnimID', `NOT NULL') + ,date DATE NOT NULL + ,start TIME NOT NULL + noseconds_check(`Start') + ,stop TIME NOT NULL + noseconds_check(`Stop') + ,commid TEXT NOT NULL + REFERENCES comm_ids + ,swelling TEXT NOT NULL + REFERENCES cycle_states + ,bananas INTEGER + positive_check(`Bananas') + ,arrivaldegree INTEGER NOT NULL + CONSTRAINT "ArrivalDegree must be >= sdb_min_degree and <= sdb_max_degree" + CHECK (sdb_min_degree <= arrivaldegree + AND arrivaldegree <= sdb_max_degree) + ,departuredegree INTEGER NOT NULL + CONSTRAINT + "DepartureDegree must be >= sdb_min_degree and <= sdb_max_degree" + CHECK (sdb_min_degree <= departuredegree + AND departuredegree <= sdb_max_degree) + ,recorder TEXT NOT NULL + REFERENCES people + ,observer2 TEXT NOT NULL + REFERENCES people + ,cycleold TEXT NOT NULL + notonlyspaces_check(`CycleOld') + + CONSTRAINT "Start cannot be after Stop" + CHECK(start <= stop) +); + +grant_priv(`ATTENDANCE') diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 52f7241..7da4f10 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -147,6 +147,35 @@ sdb_generated_rst()dnl .. |ARRIVAL_SOURCES.Description| replace:: :ref:`Description ` +.. |ATTENDANCE| + replace:: :ref:`ATTENDANCE ` +.. |ATTENDANCE.AtID| replace:: + :ref:`AtID ` +.. |ATTENDANCE.AnimID| replace:: + :ref:`AnimID ` +.. |ATTENDANCE.Date| replace:: + :ref:`Date ` +.. |ATTENDANCE.Start| replace:: + :ref:`Start ` +.. |ATTENDANCE.Stop| replace:: + :ref:`Stop ` +.. |ATTENDANCE.CommID| replace:: + :ref:`CommID ` +.. |ATTENDANCE.Swelling| replace:: + :ref:`Swelling ` +.. |ATTENDANCE.Bananas| replace:: + :ref:`Bananas ` +.. |ATTENDANCE.ArrivalDegree| replace:: + :ref:`ArrivalDegree ` +.. |ATTENDANCE.DepartureDegree| replace:: + :ref:`DepartureDegree ` +.. |ATTENDANCE.Recorder| replace:: + :ref:`Recorder ` +.. |ATTENDANCE.Observer2| replace:: + :ref:`Observer2 ` +.. |ATTENDANCE.CycleOld| replace:: + :ref:`CycleOld ` + .. |BIOGRAPHY_DATA| replace:: :ref:`BIOGRAPHY_DATA ` .. |BIOGRAPHY_DATA.AnimID| replace:: diff --git a/doc/src/tables.m4 b/doc/src/tables.m4 index 51edd2d..9d7c9f0 100644 --- a/doc/src/tables.m4 +++ b/doc/src/tables.m4 @@ -35,6 +35,7 @@ and are therefore the result of at least a rudimentary analytical process. tables/aggression_event_log.rst tables/aggressions.rst tables/arrivals.rst + tables/attendance.rst tables/biography_data.rst tables/biography_log.rst tables/comm_membs.rst diff --git a/doc/src/tables/attendance.m4 b/doc/src/tables/attendance.m4 new file mode 100644 index 0000000..cacab69 --- /dev/null +++ b/doc/src/tables/attendance.m4 @@ -0,0 +1,285 @@ +.. Copyright (C) 2026 The Meme Factory, Inc. 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 . + +.. M4 setup +include(constants.m4)dnl +include(macros.m4)dnl +sdb_rst_quotes(`on')dnl +sdb_generated_rst()dnl + +.. _ATTENDANCE: + +ATTENDANCE +---------- + +.. |ATTENDANCE_summary| replace:: + Each row represents a period of time during which a single + chimpanzee was present at the feeding station. + +|ATTENDANCE_summary| + +An individual should not be recorded as being at the feeding station +more than once during any given time period. +This means that for any given |ATTENDANCE.AnimID|, for any given +|ATTENDANCE.Date|, that there should not be another ATTENDANCE row for the +given individual on the given date with an |ATTENDANCE.Start| value +less than or equal to the given row's start time, when the other row's +|ATTENDANCE.Stop| value is greater than or equal to the given row's +start time. +A similar rule applies to the given row's stop time. +Which means, for any given |ATTENDANCE.AnimID|, for any given +|ATTENDANCE.Date|, that there should not be another ATTENDANCE row for the +given individual on the given date with an |ATTENDANCE.Start| value +less than or equal to the given row's stop time, when the other row's +|ATTENDANCE.Stop| value is greater than or equal to the given row's +stop time. +The system will generate a warning when there are overlaps in an +individual's presence at the feeding station. + +The |ATTENDANCE.Start| time cannot be after the |ATTENDANCE.Stop| time. + +The |ATTENDANCE.Date| must be during a period when the arriving individual +was under study. +This means that the |ATTENDANCE.Date| must be on or after the arriving +individual's |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.EntryDate| and on or +before the arriving individual's |BIOGRAPHY_DATA|.\ +|BIOGRAPHY_DATA.DepartDate|. + +The system will generate a warning if the ``sdb_male_swelling`` code +is assigned to a female, an individual with a |BIOGRAPHY_DATA|.\ +|BIOGRAPHY_DATA.Sex| value of ``sdb_female``. + +The system will generate a warning if any code other than the +``sdb_male_swelling`` code is assigned to an individual who is not a +female, an individual with a |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.Sex| +value that is not ``sdb_female``. + +Except for the unknown female individuals, those with a +|BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.AnimID| of ``sdb_stranger_female``, +or ``sdb_stranger_female2``, or ``sdb_stranger_female3``, the system +will generate a warning if the ``sdb_adolescent_swelling`` code is +assigned to a female less than ``sdb_min_adolescent_age`` +sdb_min_adolescent_age_units old or more than +``sdb_max_adolescent_age`` sdb_max_adolescent_age_units old. + +Except for the unknown female individuals, those with a +|BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.AnimID| of ``sdb_stranger_female``, +or ``sdb_stranger_female2``, or ``sdb_stranger_female3``, the system +will generate a warning if a code that is not one of +``sdb_male_swelling``, ``sdb_adolescent_swelling``, +``sdb_no_swelling``, and ``sdb_missing_swelling`` is assigned to a +female that is at least ``sdb_min_swelling_age`` +sdb_min_swelling_age_units old and less than or equal to +``sdb_max_swelling_age`` sdb_max_swelling_age_units old. + +.. contents:: + :depth: 2 + + +.. _ATTENDANCE.AtID: + +AtID (Attendance ID) +```````````````````` + +.. |ATTENDANCE.AtID_summary| replace:: |idcol| + +|ATTENDANCE.AtID_summary| |notnull| + + +.. _ATTENDANCE.AnimID: + +AnimID (Animal IDentifier) +`````````````````````````` + +.. |ATTENDANCE.AnimID_summary| replace:: + The |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.AnimID| identifying the + individual observed at the feeding station. + +|ATTENDANCE.AnimID_summary| |notnull| + + +.. _ATTENDANCE.Date: + +Date +```` + +.. |ATTENDANCE.Date_summary| replace:: + The date the individual was observed at the feeding station. + +|ATTENDANCE.Date_summary| +This date may not be before ``sdb_min_follow_date``. +|notnull| + + +.. _ATTENDANCE.Start: + +Start +````` + +.. |ATTENDANCE.Start_summary| replace:: + The time the individual arrived at the feeding station. + +|ATTENDANCE.Start_summary| +As with many other time values, this value is precise to the minute. +The "starting minute" recorded in this column is an "inclusive +endpoint", the individual arrived during the designated minute. + +The value of this column cannot be before ``sdb_min_event_start``. +|noseconds| |notnull| + + +.. _ATTENDANCE.Stop: + +Stop +```` + +.. |ATTENDANCE.Stop_summary| replace:: + The time the individual departed the feeding station. + +|ATTENDANCE.Stop_summary| +As with many other time values, this value is precise to the minute. +The "ending minute" recorded in this column is an "inclusive +endpoint", the individual departed during the designated minute. + +The value of this column cannot be after ``sdb_max_event_stop``. +|noseconds| |notnull| + + +.. _ATTENDANCE.CommID: + +CommID +`````` + +.. |ATTENDANCE.CommID_summary| replace:: + + A code for the community observed at the feeding station. + A |COMM_IDS|.\ |COMM_IDS.CommID| value. + +|ATTENDANCE.CommID_summary| + +This value is not validated against the arriving individual's record +of community membership as recorded in other database content. + +|cannot_change| |notnull| + + +.. _ATTENDANCE.Swelling: + +Swelling +```````` + +.. |ATTENDANCE.Swelling_summary| replace:: + A code indicating the degree of the individual's sexual swelling. + A |CYCLE_STATES|.\ |CYCLE_STATES.Code| value. + +|ATTENDANCE.Swelling_summary| +|notnull| + + +.. _ATTENDANCE.Bananas: + +Bananas +``````` + +.. |ATTENDANCE.Bananas_summary| replace:: + + An integer, the number of bananas that were given to the + individual. + +|ATTENDANCE.Bananas_summary| +This value must be a positive number, less than or equal to +``sdb_max_bananas``. + +This column may be |null| when there is no record of whether or not +bananas were given. + + +.. _ATTENDANCE.ArrivalDegree: + +ArrivalDegree +````````````` + +.. |ATTENDANCE.ArrivalDegree_summary| replace:: + + The direction from which the individual arrived, on a 360 degree + circle with ``0`` being north. + +|ATTENDANCE.ArrivalDegree_summary| +The value of this column must be an integer between ``sdb_min_degree`` +and ``sdb_max_degree``, inclusive. + +This column may be |null| when there is no record of the direction +from which the individual arrived. + + +.. _ATTENDANCE.DepartureDegree: + +DepartureDegree +``````````````` + +.. |ATTENDANCE.DepartureDegree_summary| replace:: + + The direction toward which the individual traveled when they + departed, on a 360 degree circle with ``0`` being north. + +|ATTENDANCE.DepartureDegree_summary| +The value of this column must be an integer between ``sdb_min_degree`` +and ``sdb_max_degree``, inclusive. + +This column may be |null| when there is no record of the direction +toward which the individual traveled when they departed. + + +.. _ATTENDANCE.Recorder: + +Recorder +```````` + +.. |ATTENDANCE.Recorder_summary| replace:: + + The observer who recorded the attendance record. + A |PEOPLE|.\ |PEOPLE.Person| value. + +|ATTENDANCE.Recorder_summary| |notnull| + + +.. _ATTENDANCE.Observer2: + +Observer2 +````````` + +.. |ATTENDANCE.Observer2_summary| replace:: + + A second observer who was present when the attendance was recorded. + A |PEOPLE|.\ |PEOPLE.Person| value. + +|ATTENDANCE.Observer2_summary| +|notnull| + + +.. _ATTENDANCE.CycleOld: + +CycleOld +```````` + +.. |ATTENDANCE.CycleOld_summary| replace:: + + Text comprising the initial digitization of information related to + the individuals sexual swelling. + +|ATTENDANCE.CycleOld_summary| + +|notonlyspaces| |notnull| + diff --git a/include/global_constants.m4 b/include/global_constants.m4 index 7cfc02a..a893f09 100644 --- a/include/global_constants.m4 +++ b/include/global_constants.m4 @@ -50,6 +50,15 @@ dnl dnl Special values, table-specific -- hardcoded constants dnl +dnl +dnl ARRIVALS +dnl + +dnl The minimum arrival/departure degree +define(`sdb_min_degree', `0') +dnl The maximum arrival/departure degree +define(`sdb_max_degree', `359') + dnl dnl BIOGRAPHY dnl diff --git a/include/limits.m4 b/include/limits.m4 index 2cc09e2..d48fee4 100644 --- a/include/limits.m4 +++ b/include/limits.m4 @@ -85,5 +85,8 @@ define(`sdb_first_aggression_event_log_year', `1960') dnl The maximal number of foods consumed per food event (FOOD_EVENTS) define(`sdb_max_foods', `4') +dnl The maximum banana count in ATTENDANCE +define(`sdb_max_bananas', `12') + divert(`0')dnl Output with m4 again ]}])dnl End of ifdef over the whole file. -- 2.34.1