Skip to content

Commit

Permalink
feat: simulate video learning events
Browse files Browse the repository at this point in the history
Resolves #3
  • Loading branch information
jo-elimu committed Sep 21, 2024
1 parent e66900c commit 770608b
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 102 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
id,timestamp,android_id,package_name,video_id
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0
0,1726895089,e387e38700000001,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
id,timestamp,android_id,package_name,video_id
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0
0,1726895089,e387e38700000002,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
id,timestamp,android_id,package_name,video_id
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0
0,1726895089,e387e38700000003,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id,timestamp,android_id,package_name,video_id
0,1726895090,e387e38700000001,ai.elimu.analytics,0
0,1726895090,e387e38700000001,ai.elimu.analytics,0
0,1726895090,e387e38700000001,ai.elimu.analytics,0
0,1726895090,e387e38700000001,ai.elimu.analytics,0
0,1726895090,e387e38700000001,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,timestamp,android_id,package_name,video_id
0,1726895090,e387e38700000002,ai.elimu.analytics,0
0,1726895090,e387e38700000002,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
id,timestamp,android_id,package_name,video_id
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0
0,1726895091,e387e38700000001,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
id,timestamp,android_id,package_name,video_id
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0
0,1726895091,e387e38700000002,ai.elimu.analytics,0

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
id,timestamp,android_id,package_name,video_id
0,1726895091,e387e38700000003,ai.elimu.analytics,0
0,1726895091,e387e38700000003,ai.elimu.analytics,0
0,1726895091,e387e38700000003,ai.elimu.analytics,0
0,1726895091,e387e38700000003,ai.elimu.analytics,0
0,1726895091,e387e38700000003,ai.elimu.analytics,0
0,1726895091,e387e38700000003,ai.elimu.analytics,0
0,1726895091,e387e38700000003,ai.elimu.analytics,0
24 changes: 16 additions & 8 deletions simulate-video-learning-events.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@
android_ids = ['e387e38700000001', 'e387e38700000002', 'e387e38700000003']
print(basename(__file__), f'android_ids: {android_ids}')

# Should match the package name (`applicationId`) of the Analytics app:
# https://github.com/elimu-ai/analytics/blob/main/app/build.gradle
package_name = 'ai.elimu.analytics'
print(basename(__file__), f'package_name: {package_name}')

# Should be the same version as the most recent release of the Analytics app:
# https://github.com/elimu-ai/analytics/releases
analytics_version_code = 3001018
print(basename(__file__), f'analytics_version_code: {analytics_version_code}')

date = datetime.today().strftime('%Y-%m-%d')
print(basename(__file__), f'date: {date}')
date_iso_8601 = datetime.today().strftime('%Y-%m-%d')
print(basename(__file__), f'date_iso_8601: {date_iso_8601}')

def simulateVideoLearningEvent(android_id):
"""
Expand All @@ -26,11 +31,14 @@ def simulateVideoLearningEvent(android_id):
"""

id = 0
time = 0
timestamp = int(datetime.now().timestamp())

return {
'id': id,
'time': time
'timestamp': timestamp,
'android_id': android_id,
'package_name': package_name,
'video_id': 0
}

for language_code in language_codes:
Expand Down Expand Up @@ -68,9 +76,9 @@ def simulateVideoLearningEvent(android_id):
language_dir = f'lang-{language_code}'
android_id_dir = os.path.join(language_dir, f'android-id-{android_id}')
version_code_dir = os.path.join(android_id_dir, f'version-code-{analytics_version_code}')
storybook_learning_events_dir = os.path.join(version_code_dir, f'storybook-learning-events')
if not os.path.exists(storybook_learning_events_dir):
os.makedirs(storybook_learning_events_dir)
csv_path = os.path.join(storybook_learning_events_dir, f'{android_id}_{analytics_version_code}_storybook-learning-events_{date}.csv')
video_learning_events_dir = os.path.join(version_code_dir, f'video-learning-events')
if not os.path.exists(video_learning_events_dir):
os.makedirs(video_learning_events_dir)
csv_path = os.path.join(video_learning_events_dir, f'{android_id}_{analytics_version_code}_video-learning-events_{date_iso_8601}.csv')
print(basename(__file__), f'csv_path: \n{csv_path}')
video_learning_events_df.to_csv(csv_path, index=False)

0 comments on commit 770608b

Please sign in to comment.