-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: simulate video learning events
Resolves #3
- Loading branch information
Showing
7 changed files
with
146 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "pip" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
open-pull-requests-limit: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Simulate events (daily) | ||
|
||
on: | ||
schedule: | ||
- cron: 59 11 * * * | ||
|
||
jobs: | ||
simulate_events: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Simulate VideoLearningEvents | ||
run: | | ||
python simulate-video-learning-events.py | ||
- name: Git Config | ||
run: | | ||
git config user.name 'Nya Ξlimu' | ||
git config user.email '[email protected]' | ||
- name: Git Commit | ||
run: | | ||
git add **/*.csv | ||
git commit -m 'chore(ml): simulate events' --allow-empty | ||
- name: Git Push | ||
run: | | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Simulate events | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
simulate_events: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Simulate VideoLearningEvents | ||
run: | | ||
python simulate-video-learning-events.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pandas==2.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from os.path import basename | ||
import pandas | ||
|
||
language_codes = ['ENG', 'HIN', 'TGL'] | ||
print(basename(__file__), f'language_codes: {language_codes}') | ||
|
||
android_ids = ['e387e38700000001', 'e387e38700000002', 'e387e38700000003'] | ||
print(basename(__file__), f'android_ids: {android_ids}') | ||
|
||
# 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}') | ||
|
||
def simulateVideoLearningEvent(android_id): | ||
"""Simulate a VideoLearningEvent, e.g. a video being opened.""" | ||
|
||
# TODO | ||
|
||
return {} | ||
|
||
for language_code in language_codes: | ||
print(basename(__file__)) | ||
print(basename(__file__), f'language_code: {language_code}') | ||
|
||
videos_csv_url = f'https://raw.githubusercontent.com/elimu-ai/webapp/main/src/main/resources/db/content_PROD/{language_code.lower()}/videos.csv' | ||
print(basename(__file__), f'videos_csv_url: {videos_csv_url}') | ||
videos_df = pandas.read_csv(videos_csv_url) | ||
print(basename(__file__), f'videos_df: \n{videos_df}') | ||
|
||
base_url = f'http://{language_code.lower()}.elimu.ai' | ||
print(basename(__file__), f'base_url: {base_url}') | ||
|
||
rest_url = f'{base_url}/rest/v2' | ||
print(basename(__file__), f'rest_url: {rest_url}') | ||
|
||
for android_id in android_ids: | ||
print(basename(__file__)) | ||
print(basename(__file__), f'android_id: {android_id}') | ||
|
||
event = simulateVideoLearningEvent(android_id) | ||
print(basename(__file__), f'event: {event}') | ||
|
||
# Export to CSV | ||
# TODO |