import pandas as pd

path = '../.server/media/exports/robomission-2017-11-17/{entity}.csv'
load_entity = lambda name: pd.read_csv(path.format(entity=name), index_col='id')

"""
Explanation: Data
End of explanation
"""


load_entity('tasks').head()

"""
Explanation: Tasks
End of explanation
"""


load_entity('levels')

"""
Explanation: Levels
End of explanation
"""


load_entity('toolboxes')

"""
Explanation: Toolboxes
End of explanation
"""


load_entity('students').head()

"""
Explanation: Students
End of explanation
"""


load_entity('task_sessions').head()

"""
Explanation: Task Sessions
End of explanation
"""


snapshots = load_entity('program_snapshots')
snapshots.head(14)

"""
Explanation: Program Snapshots
End of explanation
"""


actions = load_entity('actions')
actions[20:30]

# Currently, there are only 4 types of action:
set(actions.name)

"""
Explanation: there are 2 granularity levels: {'edit', 'execution'}
correct field is only set for execution snapshots
order and time_delta are computed per-granularity
time_delta = number of seconds from the last snapshot of the same granularity
time_from_start = number of seconds from the start of the task session

Actions
Actions time series describes all actions we model.
State of all other entities is given by
the initial state (static data, such as tasks and levels) and the actions.
Form most analyses, it's easier to use some derived data (such as task sessions) instead of raw actions.
Actions are semi-structured: there are some common fields (e.g name, time, student, task)
and an unstructured action-specific dictionary in the data column.
Note: Although task was decided to be a common field, not all actions have it
(namely watch-instruction don't).
As a result, there are some NaNs in this column and pandas use floats for them
(it's not possible to have integers and NaNs in the same array).
End of explanation
"""


