models
Data models returned from the client and those needed to pass into client methods.
Activity
Bases: BaseModel
An activity of a subject.
Attributes:
Name | Type | Description |
---|---|---|
uid |
str
|
The activity's unique id. |
start_time |
datetime
|
The start time of the activity. |
label |
str
|
The activity's label. |
NewActivity
Bases: BaseModel
A creator model for an activity.
Attributes:
Name | Type | Description |
---|---|---|
subject_uid |
str
|
The uid of the subject to create the activity for. |
fit_files |
list[bytes]
|
A list of fit files to upload for the activity. |
start_time |
Optional[datetime]
|
The start datetime of the activity, if omitted this will default to the current time. Fit files will override this value. |
label |
Optional[str]
|
An optional label for the activity. If omitted, the label will default to "No label". Fit files will override this value. |
serialize_fit_files(v, _info)
Fit files will be attached as files separately, replace with an empty list as bytes cannot be sent in json.
Source code in watz/_endpoints/activity_create.py
NewSubject
Bases: BaseModel
A creator model for a subject.
Attributes:
Name | Type | Description |
---|---|---|
email |
str
|
The subject's email address. Currently, this will be used as the uid. |
NewTrace
Bases: BaseModel
A creator model for a trace.
Attributes:
Name | Type | Description |
---|---|---|
parent_uid |
str
|
The subject/activity uid to create the trace for. |
name |
str
|
The trace's identifier, this must be unique to the subject/activity. |
data |
Any
|
Any json-compatible data to store. |
serialize_data_json(v, _info)
Custom types such as numpy arrays, datetimes, dataclasses etc are handled by orjson, so serialize with that.
Source code in watz/_endpoints/trace_create.py
Subject
Bases: BaseModel
A subject of a researcher.
Attributes:
Name | Type | Description |
---|---|---|
uid |
str
|
The subject's unique id. Currently, this is always the subject's email address. |
email |
str
|
The subject's email address. |
activities |
list[Activity]
|
The subject's activities. |
Trace
Bases: BaseModel
A lightweight trace object, this doesn't include the data.
Attributes:
Name | Type | Description |
---|---|---|
uid |
str
|
The unique identifier for the trace. |
name |
str
|
The trace's name, unique to the parent. |
parser_id |
int
|
The id of the parser that manages the trace, for manually created, external traces this will always be 2, but e.g. for fit created traces this will be 3. Names can be duplicate across 2 different parsers. |
TraceWithData
Bases: Trace
An extended Trace
model which includes the data.
Attributes:
Name | Type | Description |
---|---|---|
data |
Any
|
Any json-compatible data. |
Created: October 19, 2023