From 770608be6bb1fcae0ff3ab25ce09276b5488da5c Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Sat, 21 Sep 2024 12:06:04 +0700 Subject: [PATCH] feat: simulate video learning events Resolves #3 --- ...8_storybook-learning-events_2024-09-21.csv | 11 --------- ...01018_video-learning-events_2024-09-21.csv | 15 ++++++++++++ ...8_storybook-learning-events_2024-09-21.csv | 13 ---------- ...01018_video-learning-events_2024-09-21.csv | 14 +++++++++++ ...8_storybook-learning-events_2024-09-21.csv | 6 ----- ...01018_video-learning-events_2024-09-21.csv | 13 ++++++++++ ...8_storybook-learning-events_2024-09-21.csv | 18 -------------- ...01018_video-learning-events_2024-09-21.csv | 6 +++++ ...8_storybook-learning-events_2024-09-21.csv | 6 ----- ...01018_video-learning-events_2024-09-21.csv | 3 +++ ...8_storybook-learning-events_2024-09-21.csv | 2 -- ...01018_video-learning-events_2024-09-21.csv | 1 + ...8_storybook-learning-events_2024-09-21.csv | 6 ----- ...01018_video-learning-events_2024-09-21.csv | 9 +++++++ ...8_storybook-learning-events_2024-09-21.csv | 12 ---------- ...01018_video-learning-events_2024-09-21.csv | 11 +++++++++ ...8_storybook-learning-events_2024-09-21.csv | 20 ---------------- ...01018_video-learning-events_2024-09-21.csv | 8 +++++++ simulate-video-learning-events.py | 24 ++++++++++++------- 19 files changed, 96 insertions(+), 102 deletions(-) delete mode 100644 lang-ENG/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-ENG/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-ENG/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-ENG/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-ENG/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-ENG/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-HIN/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-HIN/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-HIN/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-HIN/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-HIN/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-HIN/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-TGL/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-TGL/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-TGL/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-TGL/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv delete mode 100644 lang-TGL/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv create mode 100644 lang-TGL/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv diff --git a/lang-ENG/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv b/lang-ENG/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index 14dcba9..0000000 --- a/lang-ENG/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,11 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-ENG/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv b/lang-ENG/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..8b8f978 --- /dev/null +++ b/lang-ENG/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-ENG/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv b/lang-ENG/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index ccd88e4..0000000 --- a/lang-ENG/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,13 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-ENG/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv b/lang-ENG/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..35244fc --- /dev/null +++ b/lang-ENG/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-ENG/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv b/lang-ENG/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index b496944..0000000 --- a/lang-ENG/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,6 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-ENG/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv b/lang-ENG/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..51428f5 --- /dev/null +++ b/lang-ENG/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-HIN/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv b/lang-HIN/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index 1623f96..0000000 --- a/lang-HIN/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,18 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-HIN/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv b/lang-HIN/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..7f094d8 --- /dev/null +++ b/lang-HIN/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-HIN/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv b/lang-HIN/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index b496944..0000000 --- a/lang-HIN/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,6 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-HIN/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv b/lang-HIN/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..cd0bf96 --- /dev/null +++ b/lang-HIN/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-HIN/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv b/lang-HIN/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index 692ee4f..0000000 --- a/lang-HIN/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,time -0,0 diff --git a/lang-HIN/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv b/lang-HIN/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lang-HIN/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv @@ -0,0 +1 @@ + diff --git a/lang-TGL/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv b/lang-TGL/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index b496944..0000000 --- a/lang-TGL/android-id-e387e38700000001/version-code-3001018/storybook-learning-events/e387e38700000001_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,6 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-TGL/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv b/lang-TGL/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..1403b65 --- /dev/null +++ b/lang-TGL/android-id-e387e38700000001/version-code-3001018/video-learning-events/e387e38700000001_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-TGL/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv b/lang-TGL/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index 5acd1a8..0000000 --- a/lang-TGL/android-id-e387e38700000002/version-code-3001018/storybook-learning-events/e387e38700000002_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,12 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-TGL/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv b/lang-TGL/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..95ef78f --- /dev/null +++ b/lang-TGL/android-id-e387e38700000002/version-code-3001018/video-learning-events/e387e38700000002_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/lang-TGL/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv b/lang-TGL/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv deleted file mode 100644 index b2bff16..0000000 --- a/lang-TGL/android-id-e387e38700000003/version-code-3001018/storybook-learning-events/e387e38700000003_3001018_storybook-learning-events_2024-09-21.csv +++ /dev/null @@ -1,20 +0,0 @@ -id,time -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 -0,0 diff --git a/lang-TGL/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv b/lang-TGL/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv new file mode 100644 index 0000000..bea43ff --- /dev/null +++ b/lang-TGL/android-id-e387e38700000003/version-code-3001018/video-learning-events/e387e38700000003_3001018_video-learning-events_2024-09-21.csv @@ -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 diff --git a/simulate-video-learning-events.py b/simulate-video-learning-events.py index 9499e5c..5877928 100644 --- a/simulate-video-learning-events.py +++ b/simulate-video-learning-events.py @@ -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): """ @@ -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: @@ -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)