eventchain


Nameeventchain JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://github.com/tkanngiesser/eventchain
SummarySimplified Chain Analytics
upload_time2023-09-17 17:30:21
maintainer
docs_urlNone
authortkanngiesser
requires_python>=3.7
licenseApache Software License 2.0
keywords nbdev jupyter notebook python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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=shoppingcard, df2=purchases, 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.

#### Event Chain Stats

The first data frame is used to calculate some distribution statistics
of the gap betwenn event A (first time shopping card creation) and event
B (first time purchasing), <br> the second is used as a baseline and to
calculate the percentage of occurrence of event A compared to event B.

``` python
stats = get_stats(chain.first_before_first, chain.any_event_A, user_col="user_id", gap_column="gap")
```

    ==================================================
    Metric                         Value     
    ==================================================
    no_events_of_interest          4         
    all_events                     7         
    pct                            57.14285714285714
    mean_gap                       1.5       
    median_gap                     1.0       
    std_dev                        1.0       
    min_gap                        1         
    max_gap                        3         
    25th_percentile                1.0       
    50th_percentile                1.0       
    75th_percentile                1.5       
    skewness                       1.9999999999999998
    kurtosis                       4.0       
    conf_interval_lower            0.520018007729973
    conf_interval_upper            2.479981992270027
    ==================================================

### 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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tkanngiesser/eventchain",
    "name": "eventchain",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "nbdev jupyter notebook python",
    "author": "tkanngiesser",
    "author_email": "tinokanngiesser@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/33/6d/85a6acb7e3c40d42213c575b7a24b03f912cad373b944b40c1479051c299/eventchain-0.0.3.tar.gz",
    "platform": null,
    "description": "# eventchain\n\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n### What is an event chain ?\n\nAn **event chain** is basically like a series of dominoes, where\nknocking over the first one triggers the next one, and so on. In\nprocesses or systems, an \u201cevent\u201d is something that happens\u2014a trigger, an\naction, a message, etc. Once this first event occurs, it sets off a\nchain reaction of other events.\n\nImagine you\u2019re at home and your doorbell rings. That\u2019s the first event.\nThe ringing doorbell could trigger a series of other events:\n\n- Your dog starts barking because of the doorbell.\n- You get up from your chair to see who it is.\n- You open the door and greet your friend.\n- You invite your friend inside.\n- You both sit down and start talking.\n- Each of these actions is an event, and they\u2019re all connected. The\n  doorbell ringing set off a \u201cchain\u201d of events, one leading to the next.\n\nIn business or computer systems, understanding event chains can be\ncrucial for analyzing how actions and reactions are interconnected.\nKnowing how one event affects the next helps you design better\nprocesses, make systems more efficient, or find out where things might\ngo wrong.\n\n## Install\n\n``` sh\npip install eventchain\n```\n\n## How to use\n\nFill me in please! Don\u2019t forget code examples:\n\n``` python\nimport pandas as pd\nfrom eventchain.core import *\n```\n\nBuilding a new event chain is super simple:\n\nYou create a new\n[`EventChain`](https://tkanngiesser.github.io/eventchain/core.html#eventchain)\nobject with the following parameters:\n\n``` python\nchain = EventChain(df1=shoppingcard, df2=purchases, user_col=\"user_id\", timestamp_col=\"date\", suffix=[\"added_to_shoppingcard\", \"purchased\"])\n```\n\nOnce done you have access to all event chains calculated for you.\n\nAs an example let\u2019s have a look at the event chain\n**first_before_first** <br> which can be interpreted in our example as\nthe first date a user added an item to their shopping card before the\nfirst date they purchased.\n\n``` python\nchain.first_before_first\n```\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n&#10;    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n&#10;    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n\n|     | user_id | date_added_to_shoppingcard | date_purchased | gap    |\n|-----|---------|----------------------------|----------------|--------|\n| 0   | 1       | 2018-07-01                 | 2018-07-02     | 1 days |\n| 3   | 5       | 2018-07-10                 | 2018-07-11     | 1 days |\n| 4   | 6       | 2018-07-07                 | 2018-07-10     | 3 days |\n| 5   | 8       | 2018-08-01                 | 2018-08-02     | 1 days |\n\n</div>\n\nIn addition (and for illustration purposes ignoring the fact that a\nshopping cart would have its own ID), we can now check the last date a\nuser created a shopping cart before their first purchase.\n\n``` python\nchain.last_before_first\n```\n\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n&#10;    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n&#10;    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n\n|     | user_id | date_added_to_shoppingcard | date_purchased | gap    |\n|-----|---------|----------------------------|----------------|--------|\n| 0   | 1       | 2018-07-01                 | 2018-07-02     | 1 days |\n| 4   | 6       | 2018-07-08                 | 2018-07-10     | 2 days |\n\n</div>\n\nFor user_1 the first date and last date for shpping cart creation is the\nsame, however user_6 had two shopping carts created (here our\ninterpretation would be she dropped out one time).\n\nPlease note that - in these first iterations of the package - not much\ntooling has been added to do such comparisons in a convenient way, so\nyou would have to implement your own downstream analysis.\n\n#### Event Chain Stats\n\nThe first data frame is used to calculate some distribution statistics\nof the gap betwenn event A (first time shopping card creation) and event\nB (first time purchasing), <br> the second is used as a baseline and to\ncalculate the percentage of occurrence of event A compared to event B.\n\n``` python\nstats = get_stats(chain.first_before_first, chain.any_event_A, user_col=\"user_id\", gap_column=\"gap\")\n```\n\n    ==================================================\n    Metric                         Value     \n    ==================================================\n    no_events_of_interest          4         \n    all_events                     7         \n    pct                            57.14285714285714\n    mean_gap                       1.5       \n    median_gap                     1.0       \n    std_dev                        1.0       \n    min_gap                        1         \n    max_gap                        3         \n    25th_percentile                1.0       \n    50th_percentile                1.0       \n    75th_percentile                1.5       \n    skewness                       1.9999999999999998\n    kurtosis                       4.0       \n    conf_interval_lower            0.520018007729973\n    conf_interval_upper            2.479981992270027\n    ==================================================\n\n### Some areas where event chain analysis can be used:\n\nThese easy to build event chains enables lots of ways to analyse your\ndata and to answer interesting questions about your processes or\ncustomer behaviour.\n\n- Time Analyis\n- Cost Analysis\n- Dependency Mapping\n- Sensitivity Analysis\n- Simulation Models\n- Error Impact Assessment\n- Success Metrics\n- User Experience Journey\n- Feedback Loops\n- Comparative Analysis\n",
    "bugtrack_url": null,
    "license": "Apache Software License 2.0",
    "summary": "Simplified Chain Analytics",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/tkanngiesser/eventchain"
    },
    "split_keywords": [
        "nbdev",
        "jupyter",
        "notebook",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6adf31c7ffe754a955205a45cf4763dcefdbf1032a0b2150b9ada34630b78fb",
                "md5": "f8768e47003f49744c08a30fc37a8092",
                "sha256": "733f6d9a46455ee1a3e53231a53b9f34ecf7dfcb371ac62b996a64ff1e719407"
            },
            "downloads": -1,
            "filename": "eventchain-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f8768e47003f49744c08a30fc37a8092",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 9989,
            "upload_time": "2023-09-17T17:30:18",
            "upload_time_iso_8601": "2023-09-17T17:30:18.978884Z",
            "url": "https://files.pythonhosted.org/packages/a6/ad/f31c7ffe754a955205a45cf4763dcefdbf1032a0b2150b9ada34630b78fb/eventchain-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "336d85a6acb7e3c40d42213c575b7a24b03f912cad373b944b40c1479051c299",
                "md5": "1519347386abdd754a7b3a6d8f7a654d",
                "sha256": "b7b961d5354dd74ce423a0702827886bc7d4044216b79cdb9fc558b50f0ef1a2"
            },
            "downloads": -1,
            "filename": "eventchain-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "1519347386abdd754a7b3a6d8f7a654d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10995,
            "upload_time": "2023-09-17T17:30:21",
            "upload_time_iso_8601": "2023-09-17T17:30:21.027526Z",
            "url": "https://files.pythonhosted.org/packages/33/6d/85a6acb7e3c40d42213c575b7a24b03f912cad373b944b40c1479051c299/eventchain-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-17 17:30:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tkanngiesser",
    "github_project": "eventchain",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "eventchain"
}
        
Elapsed time: 0.19008s