-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat: chart for splits set events #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
ed041ed
1f0cc0d
11625b6
efbf87e
b16d095
f505a25
cbd8f88
555ae6c
f019f32
6b2ad34
95bceb4
1a0311f
045f461
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Drips💧 Charts | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11"] | ||
|
||
defaults: | ||
run: | ||
working-directory: drips/charts | ||
|
||
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: Generate Charts | ||
run: | | ||
python generate-charts.py |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Drips💧 CSVs - Nightly | ||
|
||
on: | ||
schedule: | ||
- cron: 49 23 * * * | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
defaults: | ||
run: | ||
working-directory: drips/csvs | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: 'npm' | ||
cache-dependency-path: drips/csvs/package-lock.json | ||
|
||
- run: npm ci | ||
- run: npx tsc | ||
|
||
- run: node query-events.js | ||
|
||
- name: Git Config | ||
run: | | ||
git config user.name 'Nya Ξlimu' | ||
git config user.email 'info@elimu.ai' | ||
|
||
- name: Git Commit | ||
run: | | ||
git add *.csv | ||
git commit -m 'chore(drips💧): nightly build' --allow-empty | ||
|
||
- name: Git Push | ||
run: | | ||
git push |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Drips💧 CSVs | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x, 22.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
defaults: | ||
run: | ||
working-directory: drips/csvs | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
cache-dependency-path: drips/csvs/package-lock.json | ||
- run: npm ci | ||
- run: npx tsc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Node.js CI | ||
name: Funding Splits | ||
|
||
on: | ||
push: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Drips Charts | ||
|
||
> Charts based on the CSVs in [`../csvs/`](../csvs/) | ||
|
||
## Run the Python code | ||
|
||
```python | ||
python generate-charts.py | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import matplotlib.pyplot as plt | ||
import os | ||
import pandas | ||
|
||
repos = [ | ||
# content.elimu.eth | ||
'crowdsource', | ||
'webapp', | ||
|
||
# engineering.elimu.eth | ||
'content-provider', | ||
'keyboard', | ||
'kukariri', | ||
'ml-event-simulator', | ||
'ml-storybook-reading-level', | ||
'ml-storybook-recommender', | ||
'model', | ||
|
||
# reading.engineering.elimu.eth | ||
'VoltAir', | ||
'familiar-word-reading', | ||
'herufi', | ||
'image-picker', | ||
'silabi', | ||
'sound-cards', | ||
'storybooks', | ||
'visemes', | ||
'vitabu', | ||
'walezi-android', | ||
|
||
# writing.engineering.elimu.eth | ||
'chat', | ||
'handwriting-letters', | ||
'handwriting-numbers', | ||
|
||
# math.engineering.elimu.eth | ||
'CameraColorPicker', | ||
'android_packages_apps_Calculator', | ||
'missing-number', | ||
'nambari', | ||
'nyas-space-quest', | ||
'nyas-space-quest-qd', | ||
'shapi', | ||
'soga', | ||
'tilt-game', | ||
|
||
# distribution.elimu.eth | ||
'analytics', | ||
'appstore', | ||
'launcher', | ||
'ml-authentication', | ||
'start-guide', | ||
'website', | ||
'web3-sponsors', | ||
] | ||
for repo in repos: | ||
print() | ||
print('repo:', repo) | ||
|
||
csv_path = f'../csvs/splits_{repo}.csv' | ||
print('csv_path:', csv_path) | ||
if not os.path.isfile(csv_path): | ||
print('\033[93m' + 'File not found' + '\033[0m') | ||
continue | ||
|
||
splits_csv = pandas.read_csv(csv_path) | ||
print('splits_csv: \n', splits_csv) | ||
print('splits_csv.columns:', splits_csv.columns) | ||
print('splits_csv.columns[1:]:', splits_csv.columns[1:]) | ||
|
||
# Sort values based on the most recent split event | ||
last_column = splits_csv.columns[-1] | ||
print('last_column:', last_column) | ||
splits_csv = splits_csv.sort_values(by=last_column, ascending=False) | ||
print('splits_csv: \n', splits_csv) | ||
|
||
splits_set_event_blocks = splits_csv.columns[1:].values | ||
print('splits_set_event_blocks:', splits_set_event_blocks) | ||
|
||
ethereum_addresses = splits_csv['ethereum_address'].values | ||
print('ethereum_addresses: \n', ethereum_addresses) | ||
|
||
impact_percentages = splits_csv[splits_set_event_blocks].values | ||
print('impact_percentages: \n', impact_percentages) | ||
|
||
plt.figure(figsize=(12.8, 4.8)) | ||
plt.stackplot(splits_set_event_blocks, impact_percentages, labels=ethereum_addresses) | ||
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5)) | ||
plt.tight_layout() | ||
plt.savefig(f'splits_{repo}.png') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
*.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reconsider ignoring all JavaScript files. Ignoring all JavaScript files in the Consider removing the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Drips CSVs | ||
|
||
> CSVs with data per split event | ||
|
||
## Install Dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
## Run the TypeScript Compiler | ||
|
||
```bash | ||
npx tsc | ||
``` | ||
|
||
## Run the JavaScript | ||
|
||
```bash | ||
node query-events.js | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the actionlint suggestion to avoid issues with file names containing dashes.
Actionlint suggests using
./*glob*
or-- *glob*
to avoid potential issues with file names containing dashes. Please update thegit add
command accordingly.Apply this diff to fix the issue:
Committable suggestion
Tools
actionlint