forked from darwishoptly/Results-Dashboard-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
createResultsTable.py
104 lines (84 loc) · 2.93 KB
/
createResultsTable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import sys
import time
import datetime
from sqlalchemy import distinct
import requests
import datetime
from sqlalchemy import Column, Integer, String, ForeignKey, Float, Date, PrimaryKeyConstraint, Boolean
from sqlalchemy import create_engine, event
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import backref, mapper, relation, sessionmaker
from pprint import pprint
import math
# GAE
import remote_gae
import models
remote_gae.fix_path()
remote_gae.configure_gae_with_defaults(local_gae=False)
Base = declarative_base()
engine = create_engine("postgresql+psycopg2://poweruser1:h6o3W1a5R5d@success-depot.cwgfpgjh6ucc.us-west-2.rds.amazonaws.com/sd_staging")
class Results(Base):
__tablename__ = "d_results"
account_id = Column(String, index=True)
account_name = Column(String)
month = Column(Integer)
year = Column(Integer)
exps_w_win_vars = Column(Integer)
goals_w_win_vars = Column(Integer)
exps_w_lose_vars = Column(Integer)
goals_w_lose_vars = Column( Integer)
win_undecided_exp = Column(Integer)
lose_undecided_exp = Column(Integer)
poc = Column(Boolean)
churn = Column(Boolean)
__table_args__ = (PrimaryKeyConstraint('month', 'year', 'account_id'),)
## Go add advanced targeting conditions, traffic allocation, analytics integrations,
class AppUsage(Base):
__tablename__ = "d_app_usage"
account_id = Column(String, index=True)
month = Column(Integer)
year = Column(Integer)
avg_goals_per_experiment = Column(Float)
num_experiments_started = Column(Integer)
cum_number_of_custom_segments = Column(Integer)
poc = Column(Boolean)
churn = Column(Boolean)
__table_args__ = (PrimaryKeyConstraint('month', 'year', 'account_id'),)
class GAppUsageMonthly(Base):
__tablename__ = "d_app_usage"
account_id = Column(String, index=True)
month = Column(Integer)
year = Column(Integer)
avg_goals_per_experiment = Column(Float)
num_experiments_started = Column(Integer)
number_of_custom_segments = Column(Integer)
poc = Column(Boolean)
churn = Column(Boolean)
__table_args__ = (PrimaryKeyConstraint('month', 'year', 'account_id'),)
metadata = Base.metadata
metadata.create_all(engine)
Session = sessionmaker(bind=engine)
sdstaging = Session()
r = Results()
a = AppUsage()
# r.account_id = "0"
# r.month = 1
# r.year = 1
# sdstaging.merge(r)
sdstaging.commit()
# winning_experiment_count = {} # experiments with a winning variation
# winning_goal_count = {} # goals that have a winning variation
# losing_experiment_count = {} # experiments with a losing variation
# losing_goal_count = {} # goals that are losing
# pos_undecided_experiment_count = {}
# neg_undecided_experiment_count = {}
# App Engine - monthly summary:
# experiments started
# custom segments created
# which targeting features used
# high traffic allocation to one variation
# types of experiments (MVT vs A/B vs Multipage)
# Types of goals created
# App Engine Overall Summary:
# Analytics Integrations used
# of collaborators on experiment