Skip to content

Commit 56f8148

Browse files
committed
test: video learning event without experiment data
#2271
1 parent 62ece42 commit 56f8148

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/test/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelperTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,4 +328,29 @@ public void testExtractVideoLearningEvents_v3005009() throws IOException {
328328
assertEquals("เพลง นับเลข 1-10 | เพลงเด็กอนุบาล | นับเล", videoLearningEvent.getVideoTitle());
329329
assertEquals(9, videoLearningEvent.getVideoId());
330330
}
331+
332+
/**
333+
* Test extraction of data from CSV files generated by version 3005013 of the Analytics app:
334+
* https://github.com/elimu-ai/analytics/releases/tag/3.5.13
335+
*/
336+
@Test
337+
public void testExtractVideoLearningEvents_v3005013() throws IOException {
338+
ResourceLoader resourceLoader = new ClassRelativeResourceLoader(CsvAnalyticsExtractionHelper.class);
339+
Resource resource = resourceLoader.getResource("7e89c8e7f4c68405_3005013_video-learning-events_2025-06-13.csv");
340+
File csvFile = resource.getFile();
341+
342+
List<VideoLearningEvent> videoLearningEvents = CsvAnalyticsExtractionHelper.extractVideoLearningEvents(csvFile);
343+
assertEquals(9, videoLearningEvents.size());
344+
345+
VideoLearningEvent videoLearningEvent = videoLearningEvents.get(0);
346+
assertEquals(1749775644 * 1_000L, videoLearningEvent.getTimestamp().getTimeInMillis());
347+
assertEquals("7e89c8e7f4c68405", videoLearningEvent.getAndroidId());
348+
assertEquals("ai.elimu.filamu", videoLearningEvent.getPackageName());
349+
assertNull(videoLearningEvent.getAdditionalData());
350+
assertEquals(LearningEventType.VIDEO_OPENED, videoLearningEvent.getLearningEventType());
351+
assertNull(videoLearningEvent.getResearchExperiment());
352+
assertNull(videoLearningEvent.getExperimentGroup());
353+
assertEquals("akili and me - letter b", videoLearningEvent.getVideoTitle());
354+
assertEquals(2, videoLearningEvent.getVideoId());
355+
}
331356
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
id,timestamp,package_name,additional_data,learning_event_type,research_experiment,experiment_group,video_title,video_id
2+
1,1749775644,ai.elimu.filamu,,VIDEO_OPENED,,,akili and me - letter b,2
3+
2,1749775646,ai.elimu.filamu,,VIDEO_CLOSED_BEFORE_COMPLETION,,,,2
4+
3,1749775647,ai.elimu.filamu,,VIDEO_OPENED,,,[test] a test video,44
5+
4,1749775648,ai.elimu.filamu,,VIDEO_CLOSED_BEFORE_COMPLETION,,,,44
6+
5,1749775649,ai.elimu.filamu,,VIDEO_OPENED,,,[test] a test video,44
7+
6,1749775653,ai.elimu.filamu,,VIDEO_CLOSED_BEFORE_COMPLETION,,,,44
8+
7,1749799858,ai.elimu.filamu,,VIDEO_OPENED,,,[test] a test video,44
9+
8,1749799867,ai.elimu.filamu,,VIDEO_COMPLETED,,,[test] a test video,44
10+
9,1749800215,ai.elimu.filamu,,VIDEO_OPENED,,,akili and me - the rectangle song,13

0 commit comments

Comments
 (0)