Metadata-Version: 2.1
Name: eventchain
Version: 0.0.2
Summary: Simplified Chain Analytics
Home-page: https://github.com/tkanngiesser/eventchain
Author: tkanngiesser
Author-email: tinokanngiesser@gmail.com
License: Apache Software License 2.0
Keywords: nbdev jupyter notebook python
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas
Requires-Dist: scipy
Provides-Extra: dev

# eventchain

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

### What is an event chain ?

An **event chain** is basically like a series of dominoes, where
knocking over the first one triggers the next one, and so on. In
processes or systems, an “event” is something that happens—a trigger, an
action, a message, etc. Once this first event occurs, it sets off a
chain reaction of other events.

Imagine you’re at home and your doorbell rings. That’s the first event.
The ringing doorbell could trigger a series of other events:

- Your dog starts barking because of the doorbell.
- You get up from your chair to see who it is.
- You open the door and greet your friend.
- You invite your friend inside.
- You both sit down and start talking.
- Each of these actions is an event, and they’re all connected. The
  doorbell ringing set off a “chain” of events, one leading to the next.

In business or computer systems, understanding event chains can be
crucial for analyzing how actions and reactions are interconnected.
Knowing how one event affects the next helps you design better
processes, make systems more efficient, or find out where things might
go wrong.

## Install

``` sh
pip install eventchain
```

## How to use

Fill me in please! Don’t forget code examples:

``` python
import pandas as pd
from eventchain.core import *
```

Building a new event chain is super simple:

You create a new
[`EventChain`](https://tkanngiesser.github.io/eventchain/core.html#eventchain)
object with the following parameters:

``` python
chain = EventChain(df1=visited, df2=purchased, user_col="user_id", timestamp_col="date", suffix=["added_to_shoppingcard", "purchased"])
```

Once done you have access to all event chains calculated for you.

As an example let’s have a look at the event chain
**first_before_first** <br> which can be interpreted in our example as
the first date a user added an item to their shopping card before the
first date they purchased.

``` python
chain.first_before_first
```

<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
&#10;    .dataframe tbody tr th {
        vertical-align: top;
    }
&#10;    .dataframe thead th {
        text-align: right;
    }
</style>

|     | user_id | date_added_to_shoppingcard | date_purchased | gap    |
|-----|---------|----------------------------|----------------|--------|
| 0   | 1       | 2018-07-01                 | 2018-07-02     | 1 days |
| 3   | 5       | 2018-07-10                 | 2018-07-11     | 1 days |
| 4   | 6       | 2018-07-07                 | 2018-07-10     | 3 days |
| 5   | 8       | 2018-08-01                 | 2018-08-02     | 1 days |

</div>

In addition (and for illustration purposes ignoring the fact that a
shopping cart would have its own ID), we can now check the last date a
user created a shopping cart before their first purchase.

``` python
chain.last_before_first
```

<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
&#10;    .dataframe tbody tr th {
        vertical-align: top;
    }
&#10;    .dataframe thead th {
        text-align: right;
    }
</style>

|     | user_id | date_added_to_shoppingcard | date_purchased | gap    |
|-----|---------|----------------------------|----------------|--------|
| 0   | 1       | 2018-07-01                 | 2018-07-02     | 1 days |
| 4   | 6       | 2018-07-08                 | 2018-07-10     | 2 days |

</div>

For user_1 the first date and last date for shpping cart creation is the
same, however user_6 had two shopping carts created (here our
interpretation would be she dropped out one time).

Please note that - in these first iterations of the package - not much
tooling has been added to do such comparisons in a convenient way, so
you would have to implement your own downstream analysis.

### Some areas where event chain analysis can be used:

These easy to build event chains enables lots of ways to analyse your
data and to answer interesting questions about your processes or
customer behaviour.

- Time Analyis
- Cost Analysis
- Dependency Mapping
- Sensitivity Analysis
- Simulation Models
- Error Impact Assessment
- Success Metrics
- User Experience Journey
- Feedback Loops
- Comparative Analysis
