From 613d7fd303233793b9a580950c617b15077b2e2e Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Mon, 11 May 2026 14:16:20 +0000 Subject: [PATCH] Create AGGRESSION_EVENT_LOG table --- db/schemas/sokwedb/indexes/Makefile | 2 +- .../indexes/create/aggression_event_log.m4 | 28 +++ .../indexes/drop/aggression_event_log.m4 | 24 +++ db/schemas/sokwedb/tables/Makefile | 3 +- .../tables/create/aggression_event_log.m4 | 56 +++++ doc/src/epilog.inc.m4 | 30 +++ doc/src/tables.m4 | 1 + doc/src/tables/aggression_event_log.m4 | 201 ++++++++++++++++++ include/limits.m4 | 3 + 9 files changed, 346 insertions(+), 2 deletions(-) create mode 100644 db/schemas/sokwedb/indexes/create/aggression_event_log.m4 create mode 100644 db/schemas/sokwedb/indexes/drop/aggression_event_log.m4 create mode 100644 db/schemas/sokwedb/tables/create/aggression_event_log.m4 create mode 100644 doc/src/tables/aggression_event_log.m4 diff --git a/db/schemas/sokwedb/indexes/Makefile b/db/schemas/sokwedb/indexes/Makefile index 5e69d60..29bc6a5 100644 --- a/db/schemas/sokwedb/indexes/Makefile +++ b/db/schemas/sokwedb/indexes/Makefile @@ -21,7 +21,7 @@ # This is not really important but is needed for other types of db objects. ORDER := biography_data biography_log comm_membs comm_memb_log \ follows follow_observers follow_studies events roles arrivals \ - estrus_sources estrus_states + estrus_sources estrus_states aggression_event_log ## ## CAUTION: This Makefile is not designed to be run directly. It is normally diff --git a/db/schemas/sokwedb/indexes/create/aggression_event_log.m4 b/db/schemas/sokwedb/indexes/create/aggression_event_log.m4 new file mode 100644 index 0000000..e1d5d77 --- /dev/null +++ b/db/schemas/sokwedb/indexes/create/aggression_event_log.m4 @@ -0,0 +1,28 @@ +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 UNIQUE INDEX IF NOT EXISTS aggression_event_log_year_community + ON aggression_event_log + (year, community); + + diff --git a/db/schemas/sokwedb/indexes/drop/aggression_event_log.m4 b/db/schemas/sokwedb/indexes/drop/aggression_event_log.m4 new file mode 100644 index 0000000..b2dacf9 --- /dev/null +++ b/db/schemas/sokwedb/indexes/drop/aggression_event_log.m4 @@ -0,0 +1,24 @@ +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 aggression_event_log_year_community; diff --git a/db/schemas/sokwedb/tables/Makefile b/db/schemas/sokwedb/tables/Makefile index 5eaf443..fd3951f 100644 --- a/db/schemas/sokwedb/tables/Makefile +++ b/db/schemas/sokwedb/tables/Makefile @@ -34,7 +34,8 @@ ORDER := biography_data \ roles \ humans \ species_present \ - arrivals + arrivals \ + aggression_event_log ## ## 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/aggression_event_log.m4 b/db/schemas/sokwedb/tables/create/aggression_event_log.m4 new file mode 100644 index 0000000..831b6b6 --- /dev/null +++ b/db/schemas/sokwedb/tables/create/aggression_event_log.m4 @@ -0,0 +1,56 @@ +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 aggression_event_log ( + key_column(`AGGRESSION_EVENT_LOG', `ID', INTEGER) + ,year INTEGER NOT NULL + CONSTRAINT "Year cannot be before sdb_first_aggression_event_log_year" + CHECK (year >= sdb_first_aggression_event_log_year) + ,community TEXT NOT NULL + CONSTRAINT "Community must be a COMM_IDS.CommID value" + REFERENCES comm_ids + ,brecenglish TEXT NOT NULL + notonlyspaces_check(`BRecEnglish') + ,arecswahili TEXT NOT NULL + notonlyspaces_check(`ARecSwahili') + ,arecenglishnotes TEXT NOT NULL + notonlyspaces_check(`ARecEnglishNotes') + ,arecbookextract TEXT NOT NULL + notonlyspaces_check(`ARecBookExtract') + ,brecswahili TEXT NOT NULL + notonlyspaces_check(`BRecSwahili') + ,brecbookextract TEXT NOT NULL + notonlyspaces_check(`BRecBookExtract') + ,mainfbookextract TEXT NOT NULL + notonlyspaces_check(`MaInfBookExtract') + ,mainf TEXT NOT NULL + notonlyspaces_check(`mainf') + ,schroepfer TEXT NOT NULL + notonlyspaces_check(`Schroepfer') + ,notes TEXT NOT NULL + notonlyspaces_check(`notes') +); + +grant_priv(`AGGRESSION_EVENT_LOG') diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 091b36d..da8ff32 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -51,6 +51,36 @@ sdb_generated_rst()dnl the section heading and still get a link label with the name of the table or column. +.. |AGGRESSION_EVENT_LOG| + replace:: :ref:`AGGRESSION_EVENT_LOG ` +.. |AGGRESSION_EVENT_LOG.ID| + replace:: :ref:`ID ` +.. |AGGRESSION_EVENT_LOG.Year| + replace:: :ref:`Year ` +.. |AGGRESSION_EVENT_LOG.Community| + replace:: :ref:`Community ` +.. |AGGRESSION_EVENT_LOG.BRecEnglish| + replace:: :ref:`BRecEnglish ` +.. |AGGRESSION_EVENT_LOG.ARecSwahili| + replace:: :ref:`ARecSwahili ` +.. |AGGRESSION_EVENT_LOG.ARecEnglishNotes| + replace:: :ref:`ARecEnglishNotes ` +.. |AGGRESSION_EVENT_LOG.ARecBookExtract| + replace:: :ref:`ARecBookExtract ` +.. |AGGRESSION_EVENT_LOG.BRecSwahili| + replace:: :ref:`BRecSwahili ` +.. |AGGRESSION_EVENT_LOG.BRecBookExtract| + replace:: :ref:`BRecBookExtract ` +.. |AGGRESSION_EVENT_LOG.MaInfBookExtract| + replace:: :ref:`MaInfBookExtract ` +.. |AGGRESSION_EVENT_LOG.MaInf| + replace:: :ref:`MaInf ` +.. |AGGRESSION_EVENT_LOG.Schroepfer| + replace:: :ref:`Schroepfer ` +.. |AGGRESSION_EVENT_LOG.Notes| + replace:: :ref:`Notes ` + + .. |ARRIVALS| replace:: :ref:`ARRIVALS ` .. |ARRIVALS.ArID| diff --git a/doc/src/tables.m4 b/doc/src/tables.m4 index 40bc6d0..4e1d5d4 100644 --- a/doc/src/tables.m4 +++ b/doc/src/tables.m4 @@ -32,6 +32,7 @@ and are therefore the result of at least a rudimentary analytical process. .. toctree:: :maxdepth: 3 + tables/aggression_event_log.rst tables/arrivals.rst tables/biography_data.rst tables/biography_log.rst diff --git a/doc/src/tables/aggression_event_log.m4 b/doc/src/tables/aggression_event_log.m4 new file mode 100644 index 0000000..8926be7 --- /dev/null +++ b/doc/src/tables/aggression_event_log.m4 @@ -0,0 +1,201 @@ +.. 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 + +.. _AGGRESSION_EVENT_LOG: + +AGGRESSION_EVENT_LOG +-------------------- + +.. |AGGRESSION_EVENT_LOG_summary| replace:: + + Each row contains information on the source of the data in the + AGGRESSIONS table. + There is, at most, one row per-community, per-year. + +|AGGRESSION_EVENT_LOG_summary| + +The combination of |AGGRESSION_EVENT_LOG.Community| and +|AGGRESSION_EVENT_LOG.Year| must be unique. + + +.. contents:: + :depth: 2 + + +.. _AGGRESSION_EVENT_LOG.ID: + +ID (IDentifier) +``````````````` + +.. |AGGRESSION_EVENT_LOG.ID_summary| replace:: |idcol| + +|AGGRESSION_EVENT_LOG.ID_summary| |notnull| + + +.. _AGGRESSION_EVENT_LOG.Year: + +Year +```` + +.. |AGGRESSION_EVENT_LOG.Year_summary| replace:: + The year of the information recorded in the row. + +|AGGRESSION_EVENT_LOG.Year_summary| +This value may not be before ``sdb_first_aggression_event_log_year``. + +|notnull| + + +.. _AGGRESSION_EVENT_LOG.Community: + +Community +````````` + +.. |AGGRESSION_EVENT_LOG.Community_summary| replace:: + The community of the information recorded in the row. + +|AGGRESSION_EVENT_LOG.Community_summary| +The |COMM_IDS|.\ |COMM_IDS.CommID| of the community of the information +recorded in the row. + + + +|unique| |notnull| + + +.. _AGGRESSION_EVENT_LOG.BRecEnglish: + +BRecEnglish +``````````` + +.. |AGGRESSION_EVENT_LOG.BRecEnglish_summary| replace:: + Information on what came from the B-Record notes in English. + +|AGGRESSION_EVENT_LOG.BRecEnglish_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.ARecSwahili: + +ARecSwahili +``````````` + +.. |AGGRESSION_EVENT_LOG.ARecSwahili_summary| replace:: + Information on what came from the A-Record notes in Swahili. + +|AGGRESSION_EVENT_LOG.ARecSwahili_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.ARecEnglishNotes: + +ARecEnglishNotes +```````````````` + +.. |AGGRESSION_EVENT_LOG.ARecEnglishNotes_summary| replace:: + Information on what came from the A-Record notes in English. + +|AGGRESSION_EVENT_LOG.ARecEnglishNotes_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.ARecBookExtract: + +ARecBookExtract +``````````````` + +.. |AGGRESSION_EVENT_LOG.ARecBookExtract_summary| replace:: + Information on what came from the A-Record book. + +|AGGRESSION_EVENT_LOG.ARecBookExtract_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.BRecSwahili: + +BRecSwahili +``````````` + +.. |AGGRESSION_EVENT_LOG.BRecSwahili_summary| replace:: + Information on what came from the B-Record notes in Swahili. + +|AGGRESSION_EVENT_LOG.BRecSwahili_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.BRecBookExtract: + +BRecBookExtract +``````````````` + +.. |AGGRESSION_EVENT_LOG.BRecBookExtract_summary| replace:: + Information on what came from the B-Record book. + +|AGGRESSION_EVENT_LOG.BRecBookExtract_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.MaInfBookExtract: + +MaInfBookExtract +```````````````` + +.. |AGGRESSION_EVENT_LOG.MaInfBookExtract_summary| replace:: + Information on what came from the mother-infant book. + +|AGGRESSION_EVENT_LOG.MaInfBookExtract_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.MaInf: + +MaInf +````` + +.. |AGGRESSION_EVENT_LOG.MaInf_summary| replace:: + Information on what came from the mother-infant project. + +|AGGRESSION_EVENT_LOG.MaInf_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.Schroepfer: + +Schroepfer +`````````` + +.. |AGGRESSION_EVENT_LOG.Schroepfer_summary| replace:: + Information on what came from Kara Schroepfer's PHD data. + +|AGGRESSION_EVENT_LOG.Schroepfer_summary| +|notonlyspaces| |notnull| + + +.. _AGGRESSION_EVENT_LOG.Notes: + +Notes +````` + +.. |AGGRESSION_EVENT_LOG.Notes_summary| replace:: + Other notes. + +|AGGRESSION_EVENT_LOG.Notes_summary| +|notonlyspaces| |notnull| diff --git a/include/limits.m4 b/include/limits.m4 index 04be532..61a9697 100644 --- a/include/limits.m4 +++ b/include/limits.m4 @@ -79,5 +79,8 @@ define(`sdb_first_biography_log_date', `2013-07-01') dnl The earliest possible COMM_MEMB_LOG.DateOfUpdate define(`sdb_first_memb_log_date', `2013-12-01') +dnl The earliest possible AGGRESSION_EVENT_LOG.Year value +define(`sdb_first_aggression_event_log_year', `1975') + divert(`0')dnl Output with m4 again ]}])dnl End of ifdef over the whole file. -- 2.34.1