-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_sample_data.py
More file actions
221 lines (203 loc) Β· 7.02 KB
/
init_sample_data.py
File metadata and controls
221 lines (203 loc) Β· 7.02 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
"""
Initialize the data repository with sample credit card offers and benefits
"""
import logging
from datetime import datetime, timedelta
from git_manager import GitDataManager
from models import (
DataRepository,
CreditCardOffer,
CreditCardBenefit,
RedemptionOption,
OfferCategory,
BenefitType
)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def create_sample_offers():
"""Create sample credit card offers"""
return [
CreditCardOffer(
id="offer-001",
title="5x Points on Dining",
description="Earn 5 points per dollar spent at restaurants and food delivery",
card_name="Chase Sapphire Preferred",
bank_name="Chase",
category=OfferCategory.DINING,
expiry_date=(datetime.now() + timedelta(days=90)).strftime("%Y-%m-%d"),
emoji="π½οΈ",
gradient_colors=["#f97316", "#ef4444"],
min_spend=None,
max_benefit=None,
upvotes=45,
downvotes=2
),
CreditCardOffer(
id="offer-002",
title="3% Cash Back on Gas",
description="Get 3% cash back on all gas station purchases",
card_name="Citi Custom Cash",
bank_name="Citi",
category=OfferCategory.GAS,
expiry_date=(datetime.now() + timedelta(days=60)).strftime("%Y-%m-%d"),
emoji="β½",
gradient_colors=["#06b6d4", "#0891b2"],
max_benefit=500.0,
upvotes=38,
downvotes=1
),
CreditCardOffer(
id="offer-003",
title="10% Back at Amazon",
description="Limited time offer for Prime members - 10% back on Amazon purchases",
card_name="Amazon Prime Rewards",
bank_name="Chase",
category=OfferCategory.SHOPPING,
expiry_date=(datetime.now() + timedelta(days=30)).strftime("%Y-%m-%d"),
emoji="π¦",
gradient_colors=["#8b5cf6", "#ec4899"],
min_spend=50.0,
max_benefit=200.0,
upvotes=92,
downvotes=5
),
CreditCardOffer(
id="offer-004",
title="2x Miles on Travel",
description="Earn double miles on all travel purchases including flights, hotels, and car rentals",
card_name="Capital One Venture",
bank_name="Capital One",
category=OfferCategory.TRAVEL,
expiry_date=None, # Permanent benefit
emoji="βοΈ",
gradient_colors=["#3b82f6", "#06b6d4"],
is_permanent=True,
upvotes=67,
downvotes=3
),
CreditCardOffer(
id="offer-005",
title="6% Back on Groceries",
description="Earn 6% cash back on up to $6,000 in grocery purchases per year",
card_name="Amex Blue Cash Preferred",
bank_name="American Express",
category=OfferCategory.GROCERIES,
expiry_date=None,
emoji="π",
gradient_colors=["#10b981", "#059669"],
max_benefit=360.0,
upvotes=78,
downvotes=4
)
]
def create_sample_benefits():
"""Create sample credit card benefits"""
return [
CreditCardBenefit(
id="benefit-001",
card_name="Chase Sapphire Reserve",
bank_name="Chase",
benefit_type=BenefitType.LOUNGE_ACCESS,
title="Priority Pass Lounge Access",
description="Unlimited access to 1,300+ airport lounges worldwide",
value="$469 value",
annual_fee=550.0,
is_permanent=True
),
CreditCardBenefit(
id="benefit-002",
card_name="Amex Platinum",
bank_name="American Express",
benefit_type=BenefitType.POINTS,
title="5x Points on Flights",
description="Earn 5 Membership Rewards points per dollar on flights booked directly with airlines",
value="5x points",
category=OfferCategory.TRAVEL,
annual_fee=695.0,
is_permanent=True
),
CreditCardBenefit(
id="benefit-003",
card_name="Discover it Cash Back",
bank_name="Discover",
benefit_type=BenefitType.CASHBACK,
title="Rotating 5% Categories",
description="Earn 5% cash back on rotating categories each quarter (up to $1,500)",
value="5% cashback",
conditions="Activation required each quarter",
annual_fee=0.0,
is_permanent=True
)
]
def create_sample_redemptions():
"""Create sample redemption options"""
return [
RedemptionOption(
id="redeem-001",
name="Cash Back",
rate="1 point = $0.01",
minimum_points=2500,
emoji="π΅",
available=True,
card_networks=["Visa", "Mastercard", "Discover"]
),
RedemptionOption(
id="redeem-002",
name="Travel Rewards",
rate="1 point = $0.015",
minimum_points=5000,
emoji="βοΈ",
available=True,
card_networks=["Chase", "Capital One"]
),
RedemptionOption(
id="redeem-003",
name="Gift Cards",
rate="1 point = $0.012",
minimum_points=2500,
emoji="π",
available=True,
card_networks=["All"]
),
RedemptionOption(
id="redeem-004",
name="Statement Credit",
rate="1 point = $0.01",
minimum_points=2500,
emoji="π³",
available=True,
card_networks=["All"]
),
RedemptionOption(
id="redeem-005",
name="Transfer to Partners",
rate="1:1 transfer ratio",
minimum_points=1000,
emoji="π",
available=True,
card_networks=["Amex", "Chase", "Citi"]
)
]
def main():
"""Initialize data repository with sample data"""
logger.info("Initializing data repository with sample data...")
# Initialize git manager
git_manager = GitDataManager("../ogwallet-data")
# Create data repository
data_repo = DataRepository(
offers=create_sample_offers(),
benefits=create_sample_benefits(),
redemption_options=create_sample_redemptions(),
last_updated=datetime.now(),
version="1.0.0"
)
# Save data
git_manager.save_data(data_repo)
# Commit
git_manager.commit_and_push("Initialize with sample credit card data")
logger.info(f"β
Created {len(data_repo.offers)} offers")
logger.info(f"β
Created {len(data_repo.benefits)} benefits")
logger.info(f"β
Created {len(data_repo.redemption_options)} redemption options")
logger.info("π Data repository initialized successfully!")
if __name__ == "__main__":
main()