-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample_market_definition.clj
More file actions
230 lines (223 loc) · 8.54 KB
/
example_market_definition.clj
File metadata and controls
230 lines (223 loc) · 8.54 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
221
222
223
224
225
226
227
228
229
230
;; Market
{:name "Los Angeles"
:gallon-choices {:0 7.5
:1 10
:2 15}
:default-gallon-choice :2 ; NOTE, use key
:gas-price {"87" 320
"91" 339}
:time-choices {:0 60
:1 180
:2 300}
:default-time-choice 180 ; NOTE, use value, not key here
:delivery-fee {60 599
180 399
300 349}
:tire-pressure-price 700
;; considered open if current time is between any of the pairs
;; times are defined as "number of minutes since beginning of day"
:hours [[[450 1350]] ; Mon
[[450 1350]]
[[450 1350]] ; Wed
[[450 1350]]
[[450 1350]]
[[450 1350] ; Sat
[1400 1430]]
[[450 1350]]] ; Sun
;; if closed message is nil then the hardcoded message is used:
;; "Sorry, the service hours for this ZIP code are
;; 7:30am to 8:30pm, Monday to Friday. Thank you for your business."
:closed-message nil
:manually-closed? false
:zips {"90024" {:gallon-choices {:0 7.5
:1 10
:2 15
:3 20}
:default-gallon-choice :3
;; e.g., $3.59 + ($3.59 * 0.015) = $3.64
;; (use e.g. -1.5 to make it less than price index)
:gas-price-diff-percent {"87" 1.5}
;; applied before diff-percent
:gas-price-diff-fixed {"87" 2
"91" 5}
:delivery-fee-diff-percent {60 0
180 0
300 0}
:delivery-fee-diff-fixed {60 25
180 25
300 0}
:manually-closed? false
:closed-message "Sorry, closed."
;; exclusion feature will be implemented at a later time
;; :exclusions [{:circle {:lat 91.99222
;; :lng -118.12332
;; :radius 500}}]
}
"90025" {:gas-price-diff-percent {"87" 0
"91" 0}
:gas-price-diff-fixed {"87" 0
"91" 0}
:delivery-fee-diff-percent {60 0
180 0
300 0}
:delivery-fee-diff-fixed {60 0
180 0
300 0}
:manually-closed? false
:closed-message "Sorry, this ZIP closed for no reason."}}}
;; NEW VERSION:
(def zones-test
[{:zone-id 0
:zone-name "Earth"
:rank 0
:active true
:gallon-choices {:0 7.5
:1 10
:2 15}
:default-gallon-choice :2 ; NOTE, use key
:time-choices {:0 60
:1 180
:2 300}
:default-time-choice 180 ; NOTE, use value, not key here
:delivery-fee {60 599
180 399
300 299}
:tire-pressure-price 700
:manually-closed? false
:closed-message nil
:zips [;;;;;;;;;;;;;;
;; Los Angeles
;;;;;;;;;;;;;;
;; West LA
"90028","90038","90010","90005","90020","90004","90077","90069",
"90046","90232","90034","90036","90294","90410","90409","90408",
"90407","90406","90019","90035","90211","90048","90212","90067",
"90024","90095","90016"
;; Santa Monica
"90292","90291","90066","90401","90405","90404","90402","90403",
"90272","90049","90025","90094","90064","90073","90293","90230",
"90245","90045"
;; Calabasas
"91604","91423","91403","91436","91316","91356","91364","91367",
"91302"
;; Downtown LA
"90021","90015","90014","90071","90013","90012","90017","90057",
"90011","90089","90007"
;; Pasadena
"90068","91204","90027","90039","90026"
;; Pasadena Scheduled Only
"91105","91030","90041","90029","91205","91206","90042","91103",
"91106","91104","90065","91101"
;; Beverly Hills
"90210"
;;;;;;;;;;;;
;; San Diego
;;;;;;;;;;;;
;; Central SD
"92109","92107","92106","92101","92103","92104","92116","92105",
"92102","92110","92140"
;; La Jolla
"92121","92037","92122","92117","92123","92111","92108","92126"
;; Encinitas
"92024","92091","92007","92067","92075","92014","92130","92129"
;;;;;;;;;;;;;;;;
;; Orange County
;;;;;;;;;;;;;;;
;; Newport Beach
"92625","92626","92627","92660","92617","92663","92661","92657",
"92603","92646"
;; Irvine
"92612","92614","92606","92604","92620","92618","92630"
;; Santa Ana
"92705","92780","92704","92706","92707","92701","92703"
;;;;;;;;;;
;; Seattle
;;;;;;;;;;
;; North Seattle
"98102","98112","98105","98195","98115","98103","98107","98117"
;; Central Seattle
"98134","98144","98122","98104","98101","98121","98109","98119",
"98199"
;; South Seattle
"98136","98126","98106","98108","98118","98116"
;; Bellevue
"98005","98004","98039","98007","98008","98006","98040"]}
{:zone-id 1
:zone-name "Los Angeles"
:rank 100
:active true
;; if defining :gas-price, don't also use a gas price diff in the same zone
:gas-price {"87" 305
"91" 329}
:hours [[[450 1350]]
[[450 1350]]
[[450 1350]]
[[450 1350]]
[[450 1350]]
[[450 1350]]
[[450 1350]]]
:zips [;; West LA
"90028","90038","90010","90005","90020","90004","90077","90069",
"90046","90232","90034","90036","90294","90410","90409","90408",
"90407","90406","90019","90035","90211","90048","90212","90067",
"90024","90095","90016"
;; Santa Monica
"90292","90291","90066","90401","90405","90404","90402","90403",
"90272","90049","90025","90094","90064","90073","90293","90230",
"90245","90045"
;; Calabasas
"91604","91423","91403","91436","91316","91356","91364","91367",
"91302"
;; Downtown LA
"90021","90015","90014","90071","90013","90012","90017","90057",
"90011","90089","90007"
;; Pasadena
"90068","91204","90027","90039","90026"
;; Pasadena Scheduled Only
"91105","91030","90041","90029","91205","91206","90042","91103",
"91106","91104","90065","91101"]}
{:zone-id 3445
:zone-name "90025 Weekend Closure"
:rank 1000
:active true
:hours [[[450 1350]]
[[450 1350]]
[[450 1350]]
[[450 1350]]
[[450 1350]]
[]
[]]
:zips ["90025"]}
{:zone-id 88333
:zone-name "Expensive areas"
:rank 116
:active true
:gas-price-diff-percent {"87" 33.33333
"91" 37.5}
:zips ["90025"]}
{:zone-id 2343
:zone-name "LA Outer Ring"
:rank 10000
:active true
;; when removing a time choice, be sure to consider if the default time choice still exists!
:time-choices {:0 180
:1 300}
:zips [;; Santa Monica
"90292","90291","90066","90401","90405","90404","90402","90403",
"90272","90049","90025","90094","90064","90073","90293","90230",
"90245","90045"
;; Calabasas
"91604","91423","91403","91436","91316","91356","91364","91367",
"91302"
;; Pasadena
"90068","91204","90027","90039","90026"
;; Pasadena Scheduled Only
"91105","91030","90041","90029","91205","91206","90042","91103",
"91106","91104","90065","91101"]}
{:zone-id 8
:zone-name "Pasadena Scheduled Only"
:manually-closed? true
:closed-message "On-demand service is not available at this location. If you would like to arrange for Scheduled Delivery, please contact: orders@purpleapp.com to coordinate your service."
:zips [;; Pasadena Scheduled Only
"91105","91030","90041","90029","91205","91206","90042","91103",
"91106","91104","90065","91101"]}])