Skip to content

Session Relationships

Depening on the set up of different sessions, their images not independant. If unknown, this may bias following analysis and is therefore documented in this table. You learn about common relationship types see how to add your own here.

Table Set Up

Column Name Content Type Unique Nullable Custom Constraints Linked Table
ID ID for Entry Integer True False
SessionA first Session of relationship pair Integer False False Sessions ("ID)
SessionB second Session of relationship pair Integer False False Sessions ("ID)
Relationship relationship between the relationship pair Integer False False Session Relationship Types ("ID")
OrderedSessionPair string made from SessionA and SessionB ID to ensure every session pair can only have one documented relationship String(50) True False

Functions

Test code for each function of the Session Relationships table is shown in Functions_Relationships.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
Relationships = tableClasses.T_SRelationships()

add

This function add a singular relationship to the database.

Relationships.add(sessionA: str, sessionB: str, relationship: str)

Parameters

  • sessionA: the first session of the relationship pair
  • sessionB: the second session of the relationship pair
  • relationship: the type of relationship the two sessions have.

Returns

This function returns nothing.

delete

This function deletes the relationship between two sessions from the database.

Relationships.delete(sessionA: str, sessionB: str)

Parameters

  • SessionA: first session of relationship pair
  • SessionB: second session of relationship pair

It does not matter, which session was originally documented as sessionA or sessionB. It will find it regardless.

Returns

This function returns nothing.

update

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

Relationships.update(sessionA: str, sessionB: str, colName: str, value)

Parameters

  • SessionA: first session of relationship pair
  • SessionB: second session of relationship pair
  • 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

It does not matter, which session was originally documented as sessionA or sessionB. It will find it regardless.

Returns

This function returns nothing.

get

This function gets all information for all relationships of one session or the relationship between a session pair.

Relationships.get(sessionA: str, sessionB: str = None)

Parameters

  • sessionA: first session of relationship pair
  • sessionB: second session of relationship pair. If none is given, relationsips of sessionA with any other session will be accessed.

It does not matter, which session was originally documented as sessionA or sessionB. It will find it regardless.

Returns

This function returns a pd.dataframe with one row for each documented relationship for sessionA or one row for the relationship between sessionA and sessionB.

getAll

This function gets all information for a all relationship pairs.

Relationships.getAll()

Parameters

This Function has no parameters.

Returns

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

filter

This function filters for sessions of a specific relationship type.

Sessions.filter(relationshipType: str)

Parameters

  • relationshipType: relationship type you wish to filter for

Returns

This function returns a pd.dataframe with one row for each relationship with the wanted relationship type.