From 3626f1a2d112b07e0f37688968b6cb5ee61938f4 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 27 May 2026 23:33:32 +0000 Subject: [PATCH] Change "estrus" to "swelling" in ESTRUS_SOURCES names --- db/schemas/sokwedb/indexes/Makefile | 2 +- ...{estrus_sources.m4 => swelling_sources.m4} | 4 +- ...{estrus_sources.m4 => swelling_sources.m4} | 4 +- db/schemas/sokwedb/tables/Makefile | 2 +- ...{estrus_sources.m4 => swelling_sources.m4} | 22 +-- doc/diagrams/reproduction.svg | 8 +- doc/src/analyzed/estrus_states.m4 | 26 +-- doc/src/code_tables.m4 | 13 +- doc/src/epilog.inc.m4 | 32 ++-- doc/src/tables.m4 | 2 +- doc/src/tables/estrus_sources.m4 | 166 ----------------- doc/src/tables/swelling_sources.m4 | 168 ++++++++++++++++++ 12 files changed, 226 insertions(+), 223 deletions(-) rename db/schemas/sokwedb/indexes/create/{estrus_sources.m4 => swelling_sources.m4} (87%) rename db/schemas/sokwedb/indexes/drop/{estrus_sources.m4 => swelling_sources.m4} (91%) rename db/schemas/sokwedb/tables/create/{estrus_sources.m4 => swelling_sources.m4} (74%) delete mode 100644 doc/src/tables/estrus_sources.m4 create mode 100644 doc/src/tables/swelling_sources.m4 diff --git a/db/schemas/sokwedb/indexes/Makefile b/db/schemas/sokwedb/indexes/Makefile index df9125a..e74b3d3 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 aggression_event_log sightings \ + swelling_sources estrus_states aggression_event_log sightings \ aggressions food_events groomings groom_scans attendance ## diff --git a/db/schemas/sokwedb/indexes/create/estrus_sources.m4 b/db/schemas/sokwedb/indexes/create/swelling_sources.m4 similarity index 87% rename from db/schemas/sokwedb/indexes/create/estrus_sources.m4 rename to db/schemas/sokwedb/indexes/create/swelling_sources.m4 index 1ac6f46..1fc1e46 100644 --- a/db/schemas/sokwedb/indexes/create/estrus_sources.m4 +++ b/db/schemas/sokwedb/indexes/create/swelling_sources.m4 @@ -21,9 +21,9 @@ include(`copyright.m4')dnl include(`constants.m4')dnl include(`indexmacros.m4')dnl -CREATE INDEX IF NOT EXISTS estrus_sources_date ON estrus_sources +CREATE INDEX IF NOT EXISTS swelling_sources_date ON swelling_sources (date); -CREATE INDEX IF NOT EXISTS estrus_sources_animid ON estrus_sources +CREATE INDEX IF NOT EXISTS swelling_sources_animid ON swelling_sources (animid); diff --git a/db/schemas/sokwedb/indexes/drop/estrus_sources.m4 b/db/schemas/sokwedb/indexes/drop/swelling_sources.m4 similarity index 91% rename from db/schemas/sokwedb/indexes/drop/estrus_sources.m4 rename to db/schemas/sokwedb/indexes/drop/swelling_sources.m4 index 8e42ef6..7b3842a 100644 --- a/db/schemas/sokwedb/indexes/drop/estrus_sources.m4 +++ b/db/schemas/sokwedb/indexes/drop/swelling_sources.m4 @@ -21,7 +21,7 @@ include(`copyright.m4')dnl include(`constants.m4')dnl include(`indexmacros.m4')dnl -DROP INDEX IF EXISTS estrus_sources_date; -DROP INDEX IF EXISTS estrus_sources_animid; +DROP INDEX IF EXISTS swelling_sources_date; +DROP INDEX IF EXISTS swelling_sources_animid; diff --git a/db/schemas/sokwedb/tables/Makefile b/db/schemas/sokwedb/tables/Makefile index c05f1e1..cacf456 100644 --- a/db/schemas/sokwedb/tables/Makefile +++ b/db/schemas/sokwedb/tables/Makefile @@ -22,7 +22,7 @@ # into the database after the tables they reference. ORDER := biography_data \ biography_log \ - estrus_sources \ + swelling_sources \ estrus_states \ comm_membs \ comm_memb_log \ diff --git a/db/schemas/sokwedb/tables/create/estrus_sources.m4 b/db/schemas/sokwedb/tables/create/swelling_sources.m4 similarity index 74% rename from db/schemas/sokwedb/tables/create/estrus_sources.m4 rename to db/schemas/sokwedb/tables/create/swelling_sources.m4 index d014299..cc7ed67 100644 --- a/db/schemas/sokwedb/tables/create/estrus_sources.m4 +++ b/db/schemas/sokwedb/tables/create/swelling_sources.m4 @@ -23,31 +23,31 @@ include(`tablemacros.m4')dnl include(`grants.m4')dnl dnl -CREATE TABLE estrus_sources ( - key_column(`ESTRUS_SOURCES', `ID', INTEGER) +CREATE TABLE swelling_sources ( + key_column(`SWELLING_SOURCES', `ID', INTEGER) ,source TEXT NOT NULL REFERENCES sighting_records CONSTRAINT "Source may not be sdb_sokwedb_source" CHECK(source <> 'sdb_sokwedb_source') ,date DATE NOT NULL ,animid_type_column(`animid', `AnimID', `NOT NULL') - ,estrusmin TEXT + ,swellingmin TEXT REFERENCES cycle_states CONSTRAINT - "EstrusMin may be NULL only when Source = sdb_manual_estrus" - CHECK(estrusmin IS NOT NULL + "SwellingMin may be NULL only when Source = sdb_manual_estrus" + CHECK(swellingmin IS NOT NULL OR source = 'sdb_manual_estrus') - ,estrusmax TEXT + ,swellingmax TEXT REFERENCES cycle_states CONSTRAINT - "EstrusMax may be NULL only when Source = sdb_manual_estrus" - CHECK(estrusmax IS NOT NULL + "SwellingMax may be NULL only when Source = sdb_manual_estrus" + CHECK(swellingmax IS NOT NULL OR source = 'sdb_manual_estrus') ,notes TEXT NOT NULL notonlyspaces_check(`Notes') -- Table constraints - CONSTRAINT "Both EstrusMin and EstrusMax may not be NULL" - CHECK(NOT(estrusmin IS NULL AND estrusmax IS NULL)) + CONSTRAINT "Both SwellingMin and SwellingMax may not be NULL" + CHECK(NOT(swellingmin IS NULL AND swellingmax IS NULL)) ); -grant_priv(`ESTRUS_SOURCES') +grant_priv(`SWELLING_SOURCES') diff --git a/doc/diagrams/reproduction.svg b/doc/diagrams/reproduction.svg index b7d147f..04cc7ab 100644 --- a/doc/diagrams/reproduction.svg +++ b/doc/diagrams/reproduction.svg @@ -1233,7 +1233,7 @@ id="tspan2062-31-8-7" x="29.46172" y="155.19435" - style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.82223px;font-family:Sans;-inkscape-font-specification:'Sans, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583px">ESTRUS_SOURCES + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.82223px;font-family:Sans;-inkscape-font-specification:'Sans, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583px">SWELLING_SOURCES EstrusMin * + style="stroke-width:0.264583px">SwellingMin * EstrusMax * + style="stroke-width:0.264583px">SwellingMax * Daily estrusDaily swelling` -.. |ESTRUS_SOURCES| replace:: - :ref:`ESTRUS_SOURCES ` -.. |ESTRUS_SOURCES.ID| replace:: - :ref:`ID ` -.. |ESTRUS_SOURCES.Source| replace:: - :ref:`Source ` -.. |ESTRUS_SOURCES.Date| replace:: - :ref:`Date ` -.. |ESTRUS_SOURCES.AnimID| replace:: - :ref:`AnimID ` -.. |ESTRUS_SOURCES.EstrusMin| replace:: - :ref:`EstrusMin ` -.. |ESTRUS_SOURCES.EstrusMax| replace:: - :ref:`EstrusMax ` -.. |ESTRUS_SOURCES.Notes| replace:: - :ref:`Notes ` +.. |SWELLING_SOURCES| replace:: + :ref:`SWELLING_SOURCES ` +.. |SWELLING_SOURCES.ID| replace:: + :ref:`ID ` +.. |SWELLING_SOURCES.Source| replace:: + :ref:`Source ` +.. |SWELLING_SOURCES.Date| replace:: + :ref:`Date ` +.. |SWELLING_SOURCES.AnimID| replace:: + :ref:`AnimID ` +.. |SWELLING_SOURCES.SwellingMin| replace:: + :ref:`SwellingMin ` +.. |SWELLING_SOURCES.SwellingMax| replace:: + :ref:`SwellingMax ` +.. |SWELLING_SOURCES.Notes| replace:: + :ref:`Notes ` .. |ESTRUS_STATES| replace:: :ref:`ESTRUS_STATES ` .. |ESTRUS_STATES.ID| replace:: diff --git a/doc/src/tables.m4 b/doc/src/tables.m4 index 9d7c9f0..ff4219e 100644 --- a/doc/src/tables.m4 +++ b/doc/src/tables.m4 @@ -40,7 +40,7 @@ and are therefore the result of at least a rudimentary analytical process. tables/biography_log.rst tables/comm_membs.rst tables/comm_memb_log.rst - tables/estrus_sources.rst + tables/swelling_sources.rst tables/events.rst tables/follows.rst tables/follow_observers.rst diff --git a/doc/src/tables/estrus_sources.m4 b/doc/src/tables/estrus_sources.m4 deleted file mode 100644 index 88254fc..0000000 --- a/doc/src/tables/estrus_sources.m4 +++ /dev/null @@ -1,166 +0,0 @@ -.. 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 - -.. _ESTRUS_SOURCES: - -ESTRUS_SOURCES -------------------------- - -.. |ESTRUS_SOURCES_summary| replace:: - There is a row for each female chimpanzee, for each date estrus - information was recorded, for each kind of record -- that is not a - TRec -- where the estrus information was recorded. - Rows exist both for non-BRec related sightings, and for BRec - related sighting when those sightings were recorded in the old, MS - Access based, database. - Going forward, this table is used to make non-BRec related, changes - to the per-day record of female chimpanzee estrus information found - in the |ESTRUS_STATES| table. - -|ESTRUS_SOURCES_summary| - -This table provides a way to incorporate estrus state information from -records kept outside of SokweDB into the per-individual, per-day -estrus state information found in the |ESTRUS_STATES| table. -See :ref:`the ESTRUS_STATE documentation ` -or further information on how estrus state information is summarized -in the |ESTRUS_STATES| table. - -There must either be a non-|null| |ESTRUS_SOURCES.EstrusMin| value or -a non-|null| |ESTRUS_SOURCES.EstrusMax| value; in a single row, both -the |ESTRUS_SOURCES.EstrusMin| and the |ESTRUS_SOURCES.EstrusMax| may -not be |null|. - -The |ESTRUS_SOURCES.AnimID| value must be that of a female. -This means that the |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.Sex| value must -be ``sdb_female``. - -The |ESTRUS_SOURCES.Date| must be during a period when the sighted -individual was under study, on or after the individual's -|BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.EntryDate| and on or before the -individual's |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.DepartDate|. -Further, the |ESTRUS_SOURCES.Date| must be on a day when the -individual is between sdb_min_adolescent_age -sdb_min_adolescent_age_units old and sdb_max_swelling_age -sdb_max_swelling_age_units old, inclusive of endpoints.\ [#f1]_ - -.. contents:: - :depth: 2 - - -.. _ESTRUS_SOURCES.ID: - -ID (IDentifier) -``````````````` - -.. |ESTRUS_SOURCES.ID_summary| replace:: - |idcol| - -|ESTRUS_SOURCES.ID_summary| |notnull| - - -.. _ESTRUS_SOURCES.Source: - -Source -`````` - -.. |ESTRUS_SOURCES.Source_summary| replace:: - Code indicating the record in which the estrus state was - recorded. - A |SIGHTING_RECORDS|.\ |SIGHTING_RECORDS.Code| value. - -|ESTRUS_SOURCES.Source_summary| -The special value ``sdb_sowkedb_source`` may not appear as a value in -this column. - -|notnull| - - -.. _ESTRUS_SOURCES.Date: - -Date -```` - -.. |ESTRUS_SOURCES.Date_summary| replace:: - The date of the individual's estrus state measurement. - -|ESTRUS_SOURCES.Date_summary| |notnull| - - -.. _ESTRUS_SOURCES.AnimID: - -AnimID (Animal IDentifier) -`````````````````````````` - -.. |ESTRUS_SOURCES.AnimID_summary| replace:: - The |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.AnimID| of the individual - who's estrus state was recorded. - -|ESTRUS_SOURCES.AnimID_summary| |notnull| - - -.. _ESTRUS_SOURCES.EstrusMin: - -EstrusMin (Estrus Minimum swelling) -``````````````````````````````````` - -.. |ESTRUS_SOURCES.EstrusMin_summary| replace:: - The minimum estrus swelling observed on the day. - A |CYCLE_STATES|.\ |CYCLE_STATES.Code| value. - -|ESTRUS_SOURCES.EstrusMin_summary| - -This value may only be |null| when the |ESTRUS_SOURCES.Source| value -is ``sdb_manual_estrus``. - - -.. _ESTRUS_SOURCES.EstrusMax: - -EstrusMax (Estrus Maximum swelling) -``````````````````````````````````` - -.. |ESTRUS_SOURCES.EstrusMax_summary| replace:: - The maximum estrus swelling observed by the given source on the - given day. - A |CYCLE_STATES|.\ |CYCLE_STATES.Code| value. - -|ESTRUS_SOURCES.EstrusMax_summary| - -This value may only be |null| when the |ESTRUS_SOURCES.Source| value -is ``sdb_manual_estrus``. - - -.. _ESTRUS_SOURCES.Notes: - -Notes -````` - -.. |ESTRUS_SOURCES.Notes_summary| replace:: - Textual notes related to the estrus state. - -|ESTRUS_SOURCES.Notes_summary| |notnull| - - -rubric:: Footnotes - -.. [#f1] - The lower age limit is the minimum age of adolescence, the upper - the maximum age limit for recording female sexual swelling values. diff --git a/doc/src/tables/swelling_sources.m4 b/doc/src/tables/swelling_sources.m4 new file mode 100644 index 0000000..93dfb43 --- /dev/null +++ b/doc/src/tables/swelling_sources.m4 @@ -0,0 +1,168 @@ +.. 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 + +.. _SWELLING_SOURCES: + +SWELLING_SOURCES +---------------- + +.. |SWELLING_SOURCES_summary| replace:: + There is a row for each female chimpanzee, for each date sexual + swelling information was recorded, for each kind of record -- that + is not a TRec -- where the sexual swelling information was + recorded. + Rows exist both for non-BRec related sightings, and for BRec + related sighting when those sightings were recorded in the old, MS + Access based, database. + Going forward, this table is used to make non-BRec related, changes + to the per-day record of female chimpanzee sexual swelling + information found in the |ESTRUS_STATES| table. + +|SWELLING_SOURCES_summary| + +This table provides a way to incorporate sexual swelling state +information from records kept outside of SokweDB into the +per-individual, per-day sexual swelling state information found in the +|ESTRUS_STATES| table. +See :ref:`the ESTRUS_STATE documentation ` +or further information on how sexual swelling information is +summarized in the |ESTRUS_STATES| table. + +There must either be a non-|null| |SWELLING_SOURCES.SwellingMin| value +or a non-|null| |SWELLING_SOURCES.SwellingMax| value; in a single row, +both the |SWELLING_SOURCES.SwellingMin| and the +|SWELLING_SOURCES.SwellingMax| may not be |null|. + +The |SWELLING_SOURCES.AnimID| value must be that of a female. +This means that the |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.Sex| value must +be ``sdb_female``. + +The |SWELLING_SOURCES.Date| must be during a period when the sighted +individual was under study, on or after the individual's +|BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.EntryDate| and on or before the +individual's |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.DepartDate|. +Further, the |SWELLING_SOURCES.Date| must be on a day when the +individual is between sdb_min_adolescent_age +sdb_min_adolescent_age_units old and sdb_max_swelling_age +sdb_max_swelling_age_units old, inclusive of endpoints.\ [#f1]_ + +.. contents:: + :depth: 2 + + +.. _SWELLING_SOURCES.ID: + +ID (IDentifier) +``````````````` + +.. |SWELLING_SOURCES.ID_summary| replace:: + |idcol| + +|SWELLING_SOURCES.ID_summary| |notnull| + + +.. _SWELLING_SOURCES.Source: + +Source +`````` + +.. |SWELLING_SOURCES.Source_summary| replace:: + Code indicating the record in which the sexual swelling measurement + was recorded. + A |SIGHTING_RECORDS|.\ |SIGHTING_RECORDS.Code| value. + +|SWELLING_SOURCES.Source_summary| +The special value ``sdb_sowkedb_source`` may not appear as a value in +this column. + +|notnull| + + +.. _SWELLING_SOURCES.Date: + +Date +```` + +.. |SWELLING_SOURCES.Date_summary| replace:: + The date of the individual's sexual swelling measurement. + +|SWELLING_SOURCES.Date_summary| |notnull| + + +.. _SWELLING_SOURCES.AnimID: + +AnimID (Animal IDentifier) +`````````````````````````` + +.. |SWELLING_SOURCES.AnimID_summary| replace:: + The |BIOGRAPHY_DATA|.\ |BIOGRAPHY_DATA.AnimID| of the individual + who's sexual swelling measurement was recorded. + +|SWELLING_SOURCES.AnimID_summary| |notnull| + + +.. _SWELLING_SOURCES.SwellingMin: + +SwellingMin (MINimum sexual SWELLING) +````````````````````````````````````` + +.. |SWELLING_SOURCES.SwellingMin_summary| replace:: + The minimum sexual swelling observed on the day. + A |CYCLE_STATES|.\ |CYCLE_STATES.Code| value. + +|SWELLING_SOURCES.SwellingMin_summary| + +This value may only be |null| when the |SWELLING_SOURCES.Source| value +is ``sdb_manual_estrus``. + + +.. _SWELLING_SOURCES.SwellingMax: + +SwellingMax (MAXimum sexual SWELLING) +````````````````````````````````````` + +.. |SWELLING_SOURCES.SwellingMax_summary| replace:: + The maximum sexual swelling observed by the given source on the + given day. + A |CYCLE_STATES|.\ |CYCLE_STATES.Code| value. + +|SWELLING_SOURCES.SwellingMax_summary| + +This value may only be |null| when the |SWELLING_SOURCES.Source| value +is ``sdb_manual_estrus``. + + +.. _SWELLING_SOURCES.Notes: + +Notes +````` + +.. |SWELLING_SOURCES.Notes_summary| replace:: + Textual notes related to the sexual swelling measurement. + +|SWELLING_SOURCES.Notes_summary| |notnull| + + +rubric:: Footnotes + +.. [#f1] + The lower age limit is the minimum age of adolescence, the upper + the maximum age limit for recording female sexual swelling values. -- 2.34.1