Document classes.

communication
junos 2021-04-06 12:58:32 +02:00
parent 9e16d329dd
commit b290fb6aa4
1 changed files with 68 additions and 0 deletions

View File

@ -14,6 +14,39 @@ Base = declarative_base()
class Participant(Base):
"""
A participant class, describing the participants table.
Attributes
----------
id: int
The primary key for this table.
username: str(64)
The primary pseudoanonymous identifier for each participants.
For true participants, these were assigned by E4 Connect as usernames for Empatica Studies
and had the form of uploader_0123456.
password_hash: str(128)
token: str(32)
Authentication is implemented using HTTP Basic Auth and tokens are provided for this purpose.
token_expiration_utc: datetime
Tokens expire after a preset time period.
collection_start_utc: datetime
A datetime of the first data point uploaded.
last_upload_utc: datetime
A datetime of the last data point uploaded.
day_count_uploaded: str
Days between last_upload_utc and collection_start_utc.
last_known_device_id: str(36)
Device (installation) ID that was last seen in the data.
active: bool
Is participant marked as active (i.e. collecting data)?
marked_active_utc: datetime
The time participant was first marked as active.
day_count_active: int
Days from marked_active_utc
tester: bool
Is this a tester (or a true participant)?
"""
__tablename__ = "participants"
id = Column(Integer, primary_key=True)
username = Column(String(64), index=True, unique=True)
@ -40,6 +73,29 @@ class Participant(Base):
class AWAREsensor(object):
"""
A general AWARE sensor class. It includes fields common to all tables/subclasses.
Attributes
----------
id: int
The primary key for each table.
_id: int
The original primary key, used in device's own MySQL database.
timestamp: int
Unixtime milliseconds since 1970.
device_id: str(36)
AWARE device UUID, a unique string of length 36.
Rather than identifying the device as the name suggests, this string changes on each (re)installation.
It is therefore better considered to be an installation ID.
Declared Attributes
-------------------
__tablename__: str
Table name used in the database.
participant_id: int
The foreign key relating (with the relationship) tables to the participants table.
"""
id = Column(BigInteger, primary_key=True, nullable=False)
_id = Column(BigInteger, nullable=False)
timestamp = Column(BigInteger, nullable=False)
@ -137,6 +193,18 @@ class Bluetooth(Base, AWAREsensor):
class Call(Base, AWAREsensor):
"""
Contains the calls sensor information.
Attributes
----------
call_type: int
One of the Androids call types (1 incoming, 2 outgoing, 3 missed).
call_duration: int
Length of the call session.
trace: str(40)
A hash value SHA-1 of the phone number (source or target) of the call
"""
call_type = Column(SmallInteger, nullable=False)
call_duration = Column(Integer, nullable=False)
trace = Column(String(length=40), nullable=True)