From 509d675ba0740c059d51d3dbfd3d6508ca790a0f Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Mon, 8 Sep 2025 22:28:39 +0000 Subject: [PATCH] Add HUMANS table --- db/schemas/sokwedb/tables/Makefile | 3 +- db/schemas/sokwedb/tables/create/humans.m4 | 39 ++++++++++ doc/src/epilog.inc.m4 | 10 +++ doc/src/tables.m4 | 1 + doc/src/tables/humans.m4 | 82 ++++++++++++++++++++++ 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 db/schemas/sokwedb/tables/create/humans.m4 create mode 100644 doc/src/tables/humans.m4 diff --git a/db/schemas/sokwedb/tables/Makefile b/db/schemas/sokwedb/tables/Makefile index 71c880a..5ec9b89 100644 --- a/db/schemas/sokwedb/tables/Makefile +++ b/db/schemas/sokwedb/tables/Makefile @@ -28,7 +28,8 @@ ORDER := biography_data \ follows \ follow_observers \ follow_studies \ - events + events \ + humans ## ## 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/humans.m4 b/db/schemas/sokwedb/tables/create/humans.m4 new file mode 100644 index 0000000..cffe096 --- /dev/null +++ b/db/schemas/sokwedb/tables/create/humans.m4 @@ -0,0 +1,39 @@ +dnl Copyright (C) 2025 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 humans ( + key_column(`HUMANS', `HID', `INTEGER') + ,eid INTEGER NOT NULL + REFERENCES events + ,researchers INTEGER NOT NULL + nonnegative_check(`Researchers') + ,nonresearchers INTEGER NOT NULL + nonnegative_check(`NonResearchers') + + CONSTRAINT "One of Researchers or NonResearchers must be > 0" + CHECK ((researchers > 0) OR (nonresearchers > 0)) +); + +grant_priv(`HUMANS') diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 5a67339..2a64b52 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -230,6 +230,16 @@ sdb_generated_rst()dnl .. |FOLLOW_STUDIES.Code| replace:: :ref:`Code ` +.. |HUMANS| replace:: :ref:`HUMANS ` +.. |HUMANS.HID| replace:: + :ref:`HID ` +.. |HUMANS.EID| replace:: + :ref:`EID ` +.. |HUMANS.Researchers| replace:: + :ref:`Researchers ` +.. |HUMANS.NonResearchers| replace:: + :ref:`NonResearchers ` + .. |OBS_PERIODS| replace:: :ref:`OBS_PERIODS ` .. |OBS_PERIODS.Period| replace:: :ref:`Period ` diff --git a/doc/src/tables.m4 b/doc/src/tables.m4 index 9dbe81f..062a173 100644 --- a/doc/src/tables.m4 +++ b/doc/src/tables.m4 @@ -36,3 +36,4 @@ Data Tables tables/follows.rst tables/follow_observers.rst tables/follow_studies.rst + tables/humans.rst diff --git a/doc/src/tables/humans.m4 b/doc/src/tables/humans.m4 new file mode 100644 index 0000000..a4cbbf8 --- /dev/null +++ b/doc/src/tables/humans.m4 @@ -0,0 +1,82 @@ +.. Copyright (C) 2025 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 +.. _HUMANS: + +HUMANS +------ + +.. |HUMANS_summary| replace:: + Each row records the number of, various kinds of, humans which + were present. + +|HUMANS_summary| +These are in addition to the observers that normally make the observations. + +The related |EVENTS| row must must be one that records the presence of +other species; the |EVENTS| row with an |EVENTS.EID| value that +matches the HUMANS row's |HUMANS.EID| value must have an |EVENTS|\ +.|EVENTS.Behavior| value of ``sdb_other_species``. + +.. _HUMANS.HID: + +HID (Humans ID) +``````````````` + +.. |HUMANS.HID_summary| replace:: + |idcol| + +|HUMANS.HID_summary| |notnull| + + +.. _HUMANS.EID: + +EID (Event IDentifier) +`````````````````````` + +.. |HUMANS.EID_summary| replace:: + The |EVENTS|.\ |EVENTS.EID| that identifies the event which records the + presence of non-chimpanzee species. + +|HUMANS.EID_summary| |notnull| + + +.. _HUMANS.Researchers: + +Researchers +``````````` + +.. |HUMANS.Researchers_summary| replace:: + The number of additional researchers present during the event. + +|HUMANS.Researchers_summary| +|nonnegative| |notnull| + + +.. _HUMANS.Nonresearchers: + +NonResearchers +`````````````` + +.. |HUMANS.NonResearchers_summary| replace:: + The number of additional nonresearchers present during the event. + +|HUMANS.NonResearchers_summary| +|nonnegative| |notnull| -- 2.34.1