From e56fe6aec1b54d8c759d02eee3a3685841d1c061 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Mon, 22 Sep 2025 13:34:03 +0000 Subject: [PATCH] Add ROLES table --- db/schemas/sokwedb/tables/Makefile | 1 + db/schemas/sokwedb/tables/create/roles.m4 | 35 +++++++++ doc/src/epilog.inc.m4 | 10 +++ doc/src/tables.m4 | 1 + doc/src/tables/roles.m4 | 93 +++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 db/schemas/sokwedb/tables/create/roles.m4 create mode 100644 doc/src/tables/roles.m4 diff --git a/db/schemas/sokwedb/tables/Makefile b/db/schemas/sokwedb/tables/Makefile index 18a6b8b..35867d6 100644 --- a/db/schemas/sokwedb/tables/Makefile +++ b/db/schemas/sokwedb/tables/Makefile @@ -29,6 +29,7 @@ ORDER := biography_data \ follow_observers \ follow_studies \ events \ + roles \ humans \ species_present ## diff --git a/db/schemas/sokwedb/tables/create/roles.m4 b/db/schemas/sokwedb/tables/create/roles.m4 new file mode 100644 index 0000000..cb11fa8 --- /dev/null +++ b/db/schemas/sokwedb/tables/create/roles.m4 @@ -0,0 +1,35 @@ +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 roles ( + key_column(`ROLES', `PID', INTEGER) + ,eid INTEGER NOT NULL + REFERENCES events + ,role TEXT NOT NULL + REFERENCES role_codes + ,animid_type_column(`participant', `Participant', `NOT NULL') +); + +grant_priv(`ROLES') diff --git a/doc/src/epilog.inc.m4 b/doc/src/epilog.inc.m4 index 80620fc..619b490 100644 --- a/doc/src/epilog.inc.m4 +++ b/doc/src/epilog.inc.m4 @@ -250,6 +250,16 @@ sdb_generated_rst()dnl .. |PEOPLE.Description| replace:: :ref:`Description ` .. |PEOPLE.Active| replace:: :ref:`Active ` +.. |ROLES| replace:: :ref:`ROLES ` +.. |ROLES.PID| replace:: + :ref:`PID ` +.. |ROLES.EID| replace:: + :ref:`EID ` +.. |ROLES.Role| replace:: + :ref:`Role ` +.. |ROLES.Participant| replace:: + :ref:`Participant ` + .. |ROLE_CODES| replace:: :ref:`ROLE_CODES ` .. |ROLE_CODES.Role| replace:: :ref:`Role ` diff --git a/doc/src/tables.m4 b/doc/src/tables.m4 index 18523b0..1f7b378 100644 --- a/doc/src/tables.m4 +++ b/doc/src/tables.m4 @@ -37,4 +37,5 @@ Data Tables tables/follow_observers.rst tables/follow_studies.rst tables/humans.rst + tables/roles.rst tables/species_present.rst diff --git a/doc/src/tables/roles.m4 b/doc/src/tables/roles.m4 new file mode 100644 index 0000000..aeeb464 --- /dev/null +++ b/doc/src/tables/roles.m4 @@ -0,0 +1,93 @@ +.. 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 + +.. _ROLES: + +ROLES +----- + +.. |ROLES_summary| replace:: + Each row represents a participant in an event that occurred during + a follow, whether involving the focal or not. + +|ROLES_summary| +Events may have zero or more participants involved; rows on |EVENTS| +may have zero or more related rows on ROLES. +Usually, there will be at least one participant. +But this is not true of events that are no more than a record of the +presence of other species sighted during a follow. + +.. _ROLES.PID: + +PID (Participant ID) +```````````````````` + +.. |ROLES.PID_summary| replace:: + |idcol| + The column is named PID, for Participant ID, because each row + represents a participant in the related event. + +|ROLES.EID_summary| |notnull| + + +.. _ROLES.EID: + +EID (Event ID) +`````````````` + +.. |ROLES.EID_summary| replace:: + The |EVENTS|.\ |EVENTS.EID| that identifies the event in which the + |ROLES.Participant| played a role. + + +|ROLES.EID_summary| |notnull| + + +.. _ROLES.Role: + +Role +```` + +.. |ROLES.Role_summary| replace:: + A code indicating the role played by the |ROLES.Participant| in the + event; a |ROLES|\ .|ROLES.Role| value. + +|ROLES.Role_summary| +The role code broadly describes the participants role in a behavioral +event. +For further detail the |EVENTS|\ .|EVENTS.Behavior| column must be +examined. +Depending on the behavior, there may be additional information found +in other tables related to the event. + +|notnull| + + +.. _ROLES.Participant: + +Participant +``````````` + +.. |ROLES.Participant_summary| replace:: + A |BIOGRAPHY_DATA.AnimID| identifying the individual participating + in the event. + +|ROLES.Participant_summary| |notnull| -- 2.34.1