Skip to content

Commit

Permalink
Merge pull request #154 from ddxv/main
Browse files Browse the repository at this point in the history
New blog post, some minor UIs
  • Loading branch information
ddxv authored Oct 6, 2024
2 parents fbb445b + d120520 commit b049081
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 20 deletions.
21 changes: 7 additions & 14 deletions apps/dash-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions apps/docs/blog/posts/svelte-analytics-dash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
draft: false


date: 2024-10-06

authors:
- ddxv

categories:
- Updates
---

# Analytics Dash: Switch from Superset to Custom Svelte

After quite a long break I got back into working on Open Attribution. My point of re-entering was to finally start working on the `admin-db` which would house all the user facing settings and analytics dashboard.

This very quickly brought up the issue of Superset, a no code drop in fully customizeable analytics dashboard. I was loving it, but trying to get it to work for my usecase always ended up being a time suck, and as I moved towards a more managed approach Superset wouldn't be a good fit. Maybe we can go back to it in the future.

So with that, we changed the frontend dash quite a bit. The analytics dashboard now consists of 3 apps:

1. `admin-db`: a postgres database for managing the tables for things like users, authentication, netowrks, apps etc.
2. `dash-backend`: a python Litestar backend API, currently only exposed to localhost
3. `dash-frontend`: a svelte frontend for managing the analytics dashboard. We also switched from `skeleton` to `shadcn` due to wanting to start building this project with Svelte 5 to be well positioned for the future (and because I wanted to try it out).

## Docker Re-Do

Meanwhile, I've also completely revamped the docker environment for development / deployment. A big part of this was due to removing Superset, which had come with a lof of it's own docker baggage, and more just because I'm still learning Docker.


## More to Do

- [ ] Tons more work to finish MVP of frontend: authentication, reporting levels, creatives, spend, revenue, revents
- [ ] Rewrite Docker documentation
- [ ] Remove old non-Docker documentation
- [ ] Create testing section for frontend
- [ ] Pull data from first ad network
- [ ] Start iOS and/or Android SDK

Some features are live at [demo.openattribution.com](http://demo.openattribution.com).
19 changes: 13 additions & 6 deletions apps/postback-api/tests/generate_impressions_and_clicks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Generate impressions and clicks for testing."""

import random
import time
import uuid
Expand All @@ -15,13 +17,18 @@

ADS = ["Hi!", "NewVideo123"]

INSTALL_RATE = 0.3
CLICK_THROUGH_RATE = 0.5
D1_APP_OPEN_RATE = 0.4


def main(endpoint:str) -> None:
def main(endpoint: str) -> None:
"""Start here."""
logger.info("Start continuous generate")
while True:
for network in NETWORKS:
for app in APPS:
if random.random() < 0.3:
if random.random() < INSTALL_RATE: # noqa: S311
# Simulate organic install and return
ifa = str(uuid.uuid4())
make_inapp_request(
Expand All @@ -44,8 +51,8 @@ def main(endpoint:str) -> None:
endpoint=endpoint,
)
# Decide if a click should be generated
if random.random() < 0.5: # % chance for a click
time.sleep(random.uniform(0.1, 1.0)) # Simulate delay
if random.random() < CLICK_THROUGH_RATE: # noqa: S311
time.sleep(random.uniform(0.1, 1.0)) # noqa: S311
impression_or_click(
mytype="clicks",
myapp=app,
Expand All @@ -55,8 +62,8 @@ def main(endpoint:str) -> None:
myad=ad,
endpoint=endpoint,
)
if random.random() < 0.5:
time.sleep(random.uniform(0.1, 1.0)) # Simulate delay
if random.random() < D1_APP_OPEN_RATE: # noqa: S311
time.sleep(random.uniform(0.1, 1.0)) # noqa: S311
make_inapp_request(
event_id="app_open",
myapp=app,
Expand Down

0 comments on commit b049081

Please sign in to comment.