Skip to content

Sessions Table

A Session is a continuous monitoring of one location by one camera tra. Every Location Folder is its own session and every Location Folder is documented in this table.

Table Set Up

Column Name Content Type Unique Nullable Custom Constraints Linked Table
ID ID for Entry Integer True False
Name Name of Session (SeasonFolder/LocationFolder) String(100) True False
Coordinate location coordinates String(50) False False Format: "\d{1,2}.\d{6}[NS] \d{1,2}.\d{6}[EW]"
StartDateRaw date the camera trap was set up DateTime False False
StartDateCorrected correction if there was an issue wit StartDateRaw DateTime False True
EndDateRaw date the monitoring of the camera trap ended DateTime False False
EndDateCorrected correction if there was an issue wit EndDateRaw DateTime False True
Attractiveness how likely animals are going to visit the location Integer False True 1-3
Positioning how good a camera trap has been set up Integer False True 1-3
CameraBrand manufacturer of camera trap String(50) False True
Attributes defining characteristics of the location String(100) False True
Campaign group of camera traps set up in the same way and intention Integer False False Campaigns ("ID")

Attractiveness , Positioning and Attributes and potentially CameraBrand are determined manually by an expert for each session. detailed information about these categories and how to determine them can be found here.

Attributes

Attributed are specific landscape characteristics that describe a location. Potential attributes are: Salt lick/saline, Animal path, River/Source/Waterhole, Bonanza/meadow, Area of erosion (AOE), Road, Mudhole, etc.

Attractiveness

Attractiveness describes the characteristic of a location to attract animals. The scale goes from 1 (low attractivenes) to (3 - high attractiveness). This is influenced by the different attributes a location can posess.

Positioning

Positioning decribes how well the set up of the cameratrap allows us to capture animals. The scale goes from 1 (bad positioning) to (3 - good positioning). The positioning is rated by amplitude (if the field of vision captures the locaiton well) and angle.

Functions

Test code for each function of the Sessions table is shown in Functions_Sessions.ipynb

In order to use the class functions, an instance of the class needs to be created

import T_Tables as tableClasses

#create class instance
Sessions = tableClasses.T_Sessions()

add

This function adds a singular image to the database,

Sessions.add(
        name: str,
        coordinate: str,
        campaign: str,
        startDateRaw: datetime,
        endDateRaw: datetime,
        startDateCorrected: datetime = None,
        endDateCorrected: datetime = None,
        attractiveness: int = None, 
        positioning: int = None, 
        cameraBrand: str = None,
        attributes: str = None
        )

Parameters

  • name: name of session
  • coordinate: coordinate location of session
  • campaign:
  • startDateRaw: start date of session taken from the start date of the first time folder written in the name. May be wrong due to time shifts.
  • endDateRaw: end date of session taken from the end date of the last time folder written in the name. May be wrong due to time shifts.
  • startDateCorrected: adjusted start date
  • endDateCorrected: adjusted end date
  • attractiveness: rating from 1-3
  • positioning: rating from 1-3
  • cameraBrand: brand of camera trap model (Bushnell, etc.)
  • attributes: additional info such as "salt lick", "mudhole", etc.

Returns

This funtion returns nothing.

delete

This function deletes a singular session from the database. Note, that a session cannot be deleted if it has been documented images, without the images being removed first.

Sessions.delete(name: str)

Parameters

  • name: name of the session you wish to delete

Returns

The function returns nothing.

deleteSessionInfos

This function deletes all sessions in a given list from the database. All data associated to the sessions will also be deleted. This includes: - Infos about the session - any relationships to other sessions - and Images associated to the sessions - Tags of the Images of the sessions

Sessions.deleteSessionInfos(sessionNames: list[str], verbose: bool = True)

Parameters

  • sessionNames: list of names of sessions that you want to extract the data for
  • verbose:: information about the number of tags, images and relationships that were deleted

Returns

The function returns nothing.

update

This function allows you to update information of a given column for one entry.

Sessions.update(name, colName: str, value)

Parameters

  • name: name of the session you wish to update
  • colName: name of the column where you wish to update the value
  • value: new value of given column. Make sure that the value matched the data type of the column

Returns

The function returns nothing.

getAll

This function gets all information for a all sessions.

Sessions.getAll()

Parameters

This Function has no parameters.

Returns

This function returns a pd.dataframe with one row for each documented session.

filter

This function gets information for all sessions matching the given filtering criteria.

Sessions.filter(
        minPositioning: int = 1,
        maxPositioning: int = 3,
        minAttractiveness: int = 1,
        maxAttractiveness: int = 3,
        cameraBrand: str = None,
        campaign: str = None,
        organization: str = None,
        startAfter: datetime = None,
        endBefore: datetime = None
        )

Parameters - minPositioning: lowest position rating a session needs to have - maxPositioning: highest position rating a session needs to have - minAttractiveness: lowest attractiveness rating a session needs to have - maxAttractiveness: attractiveness rating a session needs to have - cameraBrand: brand of camera trap model (Bushnell, etc.) - campaign: campaign the session belongs to - organization: organization the campaign of the session belongs to - startAfter: session starts after this time point - endBefore: session ends before this time point

Returns

This function returns a pd.dataframe with one row for each session that fits the filtering criteria. The current implementation will never return sessions that don't have a position or attractiveness rating.

countSessionImages

This function counts for each given session, how many images belong to that session.

Sessions.countSessionImages(sessionNames: list[str])

Parameters

  • sessionNames: list of names of sessions that you want to extract the data for

Returns

This function returns a pd.dataframe with 2 columns "Name" and "Image Count"

checkMissingRelationships

Depening on the set up of different sessions, their images not independant. If unknown, this may bias following analysis. This function checks if there are locations with identical coordinates that don't have a documented relationship.

Sessions.checkMissingRelationships(DistanceThresholdMeter: float = 30, TimeThresholdDays: int = 30)

Parameters

  • DistanceThresholdMeter: a float that is the maximum distance in meters, that camera trap coordinates can be apart and still be considered to have a potential relationship. The default is 30 meters and all currently documented relationships have this threshold.
  • TimeThresholdDays: an integer that is the maximum number of days, that the camera trap end date can have to the start date to the other and still be considered to have a potential relationship. The default is 30 days and all currently documented relationships have this threshold. Returns

This function returns a pd.dataframe with Columns "sessionA", "sessionB" and "relationship". The relationship column is empty and can then be filled out manually and used to read the data into the database again. You can add your own relationship type or look at common existing ones here.

getSessionsInfos

This function gets a reduced and cleaned version of a list of requested sessions.

Sessions.getSessionsInfos(
        sessionNames: list[str],
        includeCoordinate: bool = True,
        includeStartEndDates: bool = True,
        includeAttractiveness: bool = False,
        includePositioning: bool = False,
        includeCameraBrand: bool = False,
        ecolLocations: bool = True,
        aiLocations: bool = True
        )

Parameters

  • sessionNames: list of sessions you wish to extract information for
  • includeCoordinate: returns a column with the coordinates of the sessions
  • includeStartEndDates: returns two columns with the start data and end date of the sessions. It will return the corrected start and end date if one has been documented, otherwise it will return the raw start and end dates.
  • includeAttractiveness: returns a column with the attractiveness rating of the sessions
  • includePositioning: returns a column with the positioning rating of the sessions
  • includeCameraBrand: returns a column with the camera brand of the sessions
  • ecolLocations: returns a column with a numbering of the sessions, where sessions that are considered to be ecologically dependant have the same number. This may be the case if two cameras set up together and have images of the same individuals.
  • aiLocations: returns a column with a numbering of the sessions, where sessions that are considered to be AI dependant have the same number. This may be the case if there may be a short time gap between two sessions but the view has stayed identical.

You can find mor information for ecolLocations and aiLocations in Session Relationship Types.

Returns

This function returns a pd.Dataframe with one row for each requested session and all columns that were requested.