Example of Page Transition

[1]:
# import openLA as la
import OpenLA as la
[2]:
course_info, event_stream = la.start_analysis(files_dir="dataset_sample", course_id="A")

Before conversion

[3]:
event_stream.df
[3]:
userid contentsid operationname pageno marker memo_length devicecode eventtime
0 A_U1 C1 PREV 10 NaN 0 tablet 2018-04-09 10:57:15
1 A_U1 C1 PREV 9 NaN 0 tablet 2018-04-09 11:00:59
2 A_U1 C1 PREV 8 NaN 0 tablet 2018-04-09 11:03:31
3 A_U1 C1 PREV 30 NaN 0 tablet 2018-04-10 10:14:12
4 A_U1 C1 PREV 29 NaN 0 tablet 2018-04-10 10:27:24
... ... ... ... ... ... ... ... ...
263279 A_U99 C8 NEXT 3 NaN 0 pc 2018-06-05 16:16:18
263280 A_U99 C8 ADD MARKER 4 difficult 0 pc 2018-06-05 16:18:34
263281 A_U99 C8 NEXT 4 NaN 0 pc 2018-06-05 16:19:24
263282 A_U99 C8 NEXT 5 NaN 0 pc 2018-06-05 16:20:45
263283 A_U99 C8 PREV 6 NaN 0 pc 2018-06-05 16:21:03

263284 rows × 8 columns

Behavior in each page with consideration page transition, e.g. going back and jumping page

[4]:
page_transition = la.convert_into_page_transition(event_stream=event_stream,
                                                  user_id=course_info.user_id()[:5],
                                                  contents_id="C1",
                                                  invalid_seconds=5,
                                                  timeout_seconds=20*60,
                                                  count_operation=True,
                                                  operation_name=["ADD MARKER", "ADD MEMO", "ADD BOOKMARK"],
                                                  separate_marker_type=False)
[5]:
page_transition.df
[5]:
userid contentsid pageno reading_seconds time_of_entry time_of_exit ADD MARKER ADD MEMO ADD BOOKMARK
0 A_U1 C1 9 224 2018-04-09 10:57:15 2018-04-09 11:00:59 0 0 0
1 A_U1 C1 8 152 2018-04-09 11:00:59 2018-04-09 11:03:31 0 0 0
2 A_U1 C1 29 792 2018-04-10 10:14:12 2018-04-10 10:27:24 0 0 0
3 A_U1 C1 27 595 2018-04-10 10:27:24 2018-04-10 10:37:19 0 0 0
4 A_U1 C1 28 99 2018-04-10 15:13:55 2018-04-10 15:15:34 0 0 0
... ... ... ... ... ... ... ... ... ...
1333 A_U102 C1 9 23 2018-06-05 16:12:20 2018-06-05 16:12:43 1 0 0
1334 A_U102 C1 51 63 2018-06-05 16:12:43 2018-06-05 16:13:46 0 0 0
1335 A_U102 C1 47 330 2018-06-05 16:13:46 2018-06-05 16:19:16 0 0 0
1336 A_U102 C1 48 330 2018-06-05 16:19:16 2018-06-05 16:24:46 1 0 0
1337 A_U102 C1 23 473 2018-06-05 16:24:46 2018-06-05 16:32:39 0 0 0

1338 rows × 9 columns

Save the data to CSV file

[6]:
page_transition.to_csv(save_file="data.csv")

Aggregate Information

[7]:
# Number of users in the data
page_transition.num_users()
[7]:
5
[8]:
# User ids in the data
page_transition.user_id()
[8]:
['A_U1', 'A_U10', 'A_U100', 'A_U101', 'A_U102']
[9]:
# Contents ids in the data
page_transition.contents_id()
[9]:
['C1']
[10]:
# Operation names in the data
page_transition.operation_name()
[10]:
['ADD MARKER', 'ADD MEMO', 'ADD BOOKMARK']
[11]:
# Number of selected operation logs
page_transition.operation_count(operation_name="ADD MARKER",
                                user_id="A_U1",
                                contents_id="C1")
[11]:
2
[12]:
page_transition.operation_count(operation_name=["ADD MARKER", "ADD BOOKMARK"],
                                user_id="A_U1",
                                contents_id="C1")
[12]:
{'ADD MARKER': 2, 'ADD BOOKMARK': 3}
[28]:
# Number of unique pages in the data
page_transition.num_unique_pages(user_id="A_U1", contents_id="C1")
[28]:
67
[29]:
# Total reading seconds in the data
page_transition.reading_seconds(user_id="A_U1", contents_id="C1")
[29]:
42748
[30]:
# Total reading time in the data (seconds)
page_transition.reading_time(time_unit="seconds", user_id="A_U1", contents_id="C1")
[30]:
42748
[31]:
# Total reading time in the data (minutes)
page_transition.reading_time(time_unit="minutes", user_id="A_U1", contents_id="C1")
[31]:
712.4666666666667
[32]:
# Total reading time in the data (hours)
page_transition.reading_time(time_unit="hours", user_id="A_U1", contents_id="C1")
[32]:
11.874444444444444
[33]:
# Number of page transition (number of reading pages including duplication)
page_transition.num_transition(user_id="A_U1", contents_id="C1")
[33]:
363