DYADS¶
Each row represents a dyadic interaction between two individuals. Having both individuals appear in one row can make the data eaiser to work with.
The view puts the individual performing an action and the
individual receiving the action in separate columns.
There is a flag to indicate whether the action is mutual; when
TRUE ,there is not meaning to the placement of the interacting
individuals into these two columns.
This view extends the OBS view with columns for the individual performing the action and the individual receiving the action.
The DYADS view can be a core component when querying dyadic interactions.
For an example use of the DYADS view, see the PANTGRUNTS_VIEW
documentation.
It joins the DYADS view with the PANTGRUNTS table to provide a
more-or-less complete report on pantgrunt data.
It uses DYADS to supply the date, time, and participants and adds to
that the detailed data on pantgrunts found in PANTGRUNTS.
Queries similar to the SELECT statement found within the
PANTGRUNTS_VIEW definition can be written to report on the other
behaviors recorded as dyadic interactions – groomings, matings,
aggressions, etc.
Definition¶
CREATE OR REPLACE VIEW dyads (
wid
,date
,focal
,type
,commid
,eid
,behavior
,start
,stop
,certainty
,actor_pid
,actor
,recipient_pid
,recipient
,twosided
,notes
,event_notes
)
AS
SELECT
obs.wid
,obs.date
,obs.focal
,obs.type
,obs.commid
,obs.eid
,obs.behavior
,obs.start
,obs.stop
,obs.certainty
,actors.pid AS actor_pid
,actors.participant AS actor
,recipients.pid AS recipient_pid
,recipients.participant AS recipient
,CASE
WHEN actors.role = 'Mutual' THEN
TRUE
ELSE
FALSE
END AS twosided
,obs.notes
,obs.event_notes
FROM obs
JOIN roles AS actors
ON (actors.eid = obs.eid
AND (actors.role = 'Actor'
OR actors.role = 'Mutual'))
JOIN roles AS recipients
ON (recipients.eid = obs.eid
AND (recipients.role = 'Actee'
OR recipients.role = 'Mutual'))
WHERE (actors.role = 'Actor'
OR -- Without further conditions, when dyads are mutual,
-- the two individuals appear as 4 rows: paired, paired
-- in reverse order, and each matched with themselves.
-- Assure consistent placement, among query executions,
-- in the actor or recipient columns.
actors.pid < recipients.pid);
ER Diagram¶
DYADS¶
Columns of the DYADS View¶
Column |
From |
Description |
|---|---|---|
WID |
Identifier of the related WATCHES row |
|
Date |
Date of the event |
|
Focal |
Focal of follow, or focal of a non-existant follow, or an un-interesting AnimID |
|
Type |
Category of observation, often determining the data collection protocol: follow, feeding station attendance, groom scans, etc. |
|
CommID |
The community identifier associated with the Date/Focal/Type |
|
EID |
Identifier of the EVENTS row |
|
Behavior |
Code designating the type of event observed |
|
Start |
Time the event started (inclusive) |
|
Stop |
Time the event finished (inclusive) |
|
Certainty |
Certainty of the event observation, when meaningful |
|
Actor_PID |
Identifier of the ROLES row containing the individual performing the action, or mutually acting |
|
Actor |
The BIOGRAPHY_DATA.AnimID of the individual performing the action, or mutually actintg |
|
Recipient |
The BIOGRAPHY_DATA.AnimID of the individual receiving the action, or mutually acting |
|
Recipient_PID |
Identifier of the ROLES row containig the individual receiving the action, or mutually acting |
|
TwoSided |
Boolean, |
|
Notes |
Textual notes on the observation for the Date/Focal/Type |
|
Event_Notes |
Textual notes on the event |
Operations Allowed¶
- INSERT
INSERTing a row into DYADS inserts two rows into ROLES. One row may also be inserted into EVENTS, and one may be inserted into WATCHES.
The columns EID, WID, Focal, Date, Type, Behavior, Start, and Stop may all be used, in the various combinations described below, to relate the new ROLES rows to existing EVENTS rows, or to create new EVENTS and WATCHES rows when they do not already exist.
If an EID is supplied, that is all that is required. The identified EVENTS row must already exist.
If an EID is not supplied, the columns WID, Focal, Date, Type, Behavior, Start, and Stop are used to query OBS. The Behavior, Start, and Stop columns must be supplied in this case.
If a WID is supplied it is used, along with Behavior, Start, and Stop, to match against database content. If a WID is not supplied, the Focal, Date, and Type columns must be supplied. Then they are used, along with Behavior, Start, and Stop, to match against database content.
If no match is found, a row is inserted into OBS. This means the rules regarding what data must be supplied when INSERTing into OBS, and when OBS re-uses existing rows or creates new rows, also apply to DYADS.
If an existing EVENTS row matches, the new ROLES rows are related to the EVENTS row so discovered. Otherwise they are related to the newly created EVENTS row.
When existing rows are found in the database, all (non-
NULL) data values supplied must match the data values that already exist.The WID, EID, Actor_PID, and Recipient_PID columns do not have their values inserted into new rows. If non-
NULLvalues are supplied for these columns they must match the values already existing in, or inserted into, the database.- UPDATE
This operation is not allowed.
- DELETE
This operation is not allowed.
Page last generated: 2026-07-01 00:11:55 UTC