Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/viyadb/events-generator

Framework for simulating mobile application user activity
https://github.com/viyadb/events-generator

dataset-generation datasets events kafka mobile-user simulator user-value

Last synced: about 1 month ago
JSON representation

Framework for simulating mobile application user activity

Awesome Lists containing this project

README

        

events-generator
=================

![Build Status](https://github.com/viyadb/events-generator/workflows/build/badge.svg)

Framework for simulating mobile application user activity, and generating events from this activity.
The project covers the following phases:

* Engagement with a mobile app advertisement (clicking or viewing)
* Installing mobile application (as a result of the engagement or organically)
* Opening application (generating a session)
* Generating custom event in application
* Uninstalling the application

Generated events can be used for testing purposes, when a big volume of real (or close to real)
data is required.

## Flow

The framework tries to emulate real-world humans interacting with mobile applications, while
taking predefined parameters into consideration.

### Participants

* Ad network (through which an advertisement was published)
* Ad campaign
* Mobile application
* Mobile user

Relations between them are the following:

+--------------+ +---------------+
| | N:N | |
| Ad Network +------------+ Ad Campaign |
| | | |
+--------------+ +-------+-------+
|
| N:1
v
+--------+ +---+---+
| | N:N | |
| User +-----------+ App |
| | | |
+--------+ +-------+

### Parameters

There are multiple coefficients taken into account when generating events:

* Click to install rate (conversion rate) per application, ad network
* App popularity
* User activity and retention rate per app

### Output Fields

| Field Name | Description |
|------------|-------------|
| app\_id | Mobile application ID |
| user\_id | 32-bit integer user ID (unique on a single app level) |
| event\_time | Event time in milliseconds from epoch |
| country | Two letter country code |
| city | City name |
| device\_type | Mobile device type (iOS, Android, etc.) |
| device\_vendor | Mobile device vendor (HP, Asus, etc.) |
| ad\_network | Ad network, which has led to the app install |
| campaign | Ad campaign, which has led to the app install |
| site\_id | Website that shown the original ad about the app |
| event\_type | Event type (install, click, inapp, etc.) |
| event\_name | In-app event name |
| organic | Whether the install was organic or not (False or True) |
| days\_from\_install | Number of days passed since install till event\_time |
| revenue | Optional in-app event revenue in USD |

## Running

### Using Docker image

There's Docker image that has all the needed environment, and runs the script for you.
To have it produce JSON events to standard output, run:

```bash
docker run --log-driver=none --rm -ti viyadb/events-generator:latest
```

For example, to have your Kafka populated with generated events run:

```bash
docker run --log-driver=none --rm -ti viyadb/events-generator:latest | \
kafka-console-producer.sh --broker-list :9092 --topic
```

#### Configuration

To configure events generator behavior when running in Docker use the following environment variables:

| Environment Variable | Description | Default value |
| -------------------- | ------------ | ------------- |
| EVENTS_NUMBER | Total number of generated events | -1 |
| CLICK\_THROUGH\_RATE | Click-through rate | 0.005 |
| CAMPAIGNS\_NUM | Number of running campaigns at any time | 10000 |
| START\_DATE | Events start date in format YYYY-MM-DD | 2015-01-01 |
| OUTPUT\_FORMAT | Events output format. Supported formats: json, tsv | json |
| OUTPUT\_HEADER | Whether to print TSV header | False |
| TIME\_FORMAT | Output time format. Supported formats are: timestamp\_millis, iso | timestamp\_millis |

For example, to have events generator produce content in TSV format use:

```bash
docker run --log-driver=none --rm -ti \
-e OUTPUT_FORMAT=tsv viyadb/events-generator:latest
```

### Without Docker

#### Prerequisites

Please make sure you have the following dependencies installed on your computer.

* Python 3

Run the following to prepare a runtime environment:

```bash
python3 -mvenv venv
source venv/bin/activate
pip install -r requirements.txt
```

#### Configuration

To list all available options, please run:

```bash
./generate.py --help
```

#### Generating events

```bash
./generate.py
```