This is code for the (forthcoming) book "Fighting Churn With Data: The Subscribed Institute Guide to Data Driven Customer Engagement". See http://www.fightchurnwithdata.com for more information.
- Python 3 and the required packages (requirements.txt)
If you need help installing Python 3, you can refer to this page for Mac:
- https://docs.python-guide.org/starting/install3/osx/ For Windows there are resources here:
(If you are on linux I'm going to assume you know how to install your own python...)
To install Postgres for Mac following these instructions: https://postgresapp.com/downloads.html
I also recommend installing installing pgAdmin to make it easier to import and export data, and run adhoc queries.
Follow the instructions here:
You will need to create a schema with the tables in the schema folder - you can use any tool or method you prefer. After that you need to load subscription and event data into those tables. For details on the subscription data see the blog posts on http://www.fightchurnwithdata.com for more information:
Running the Code
Generating Artificial Data
Code for generating artificial data to run the code is in the directory data-generation. Details to come...
You can run the book examples with the project under examples.
Currently everything is hard coded. If you want to run just one example or chapter you can uncomment the variables one_chapter and/or one_example. Command line parameters coming soon...
First you need to configure some metrics specifically for your event data in a configuration file for your schema. See the examples metric-example/conf/x_metrics.json where the "x" is replaced with your schema name. Then running metrics.py in the metric-framework folder will 1) truncate the metrics in the metric table and 2) insert new metrics defined by whatever is in the file metric-example/conf/yourschema_metrics.json.
Currently everything is hard coded, so you must set the postgres connection string, the schema, and date range in the file.
If you want to run just one metric you can uncomment the variable one_metric. Note that when running one metric currently you need to take care of deleting values yourself (if you find yourself running the same metric again after changes.)
Command line parameters coming soon...
Details coming soon...
Details coming soon...
- Carl Gold carl24k
This project is licensed under the MIT License - see the LICENSE.md file for details
- Coming soon