Repository navigation
Expand file tree
/
Copy pathseedDataCB_BV.ts
More file actions
363 lines (347 loc) Β· 8.43 KB
/
Copy pathseedDataCB_BV.ts
File metadata and controls
363 lines (347 loc) Β· 8.43 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
import { collection, addDoc, Timestamp } from 'firebase/firestore';
import { db, COLLECTIONS } from './firebase.config';
// Sample Cocoon Prices Data - CB and BV breeds only
const sampleCocoonPrices = [
{
breed: 'CB',
market: 'Mumbai',
pricePerKg: 550,
minPrice: 520,
maxPrice: 580,
avgPrice: 555,
quality: 'A',
source: 'market_admin',
verified: true,
location: {
state: 'Maharashtra',
district: 'Mumbai',
pincode: '400001'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'CB',
market: 'Bangalore',
pricePerKg: 540,
minPrice: 510,
maxPrice: 570,
avgPrice: 545,
quality: 'A',
source: 'daily_update',
verified: true,
location: {
state: 'Karnataka',
district: 'Bangalore',
pincode: '560001'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'BV',
market: 'Ramanagara',
pricePerKg: 480,
minPrice: 450,
maxPrice: 510,
avgPrice: 485,
quality: 'B',
source: 'market_admin',
verified: true,
location: {
state: 'Karnataka',
district: 'Ramanagara',
pincode: '562159'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'BV',
market: 'Mysore',
pricePerKg: 420,
minPrice: 400,
maxPrice: 450,
avgPrice: 425,
quality: 'B',
source: 'daily_update',
verified: true,
location: {
state: 'Karnataka',
district: 'Mysore',
pincode: '570001'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'CB',
market: 'Ramanagara',
pricePerKg: 535,
minPrice: 505,
maxPrice: 565,
avgPrice: 540,
quality: 'A',
source: 'market_admin',
verified: true,
location: {
state: 'Karnataka',
district: 'Ramanagara',
pincode: '562159'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'BV',
market: 'Bangalore',
pricePerKg: 475,
minPrice: 445,
maxPrice: 505,
avgPrice: 480,
quality: 'B',
source: 'daily_update',
verified: true,
location: {
state: 'Karnataka',
district: 'Bangalore',
pincode: '560001'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'BV',
market: 'Mumbai',
pricePerKg: 415,
minPrice: 395,
maxPrice: 445,
avgPrice: 420,
quality: 'C',
source: 'daily_update',
verified: true,
location: {
state: 'Maharashtra',
district: 'Mumbai',
pincode: '400001'
},
lastUpdated: Timestamp.now(),
},
{
breed: 'CB',
market: 'Mysore',
pricePerKg: 565,
minPrice: 535,
maxPrice: 595,
avgPrice: 570,
quality: 'A',
source: 'market_admin',
verified: true,
location: {
state: 'Karnataka',
district: 'Mysore',
pincode: '570001'
},
lastUpdated: Timestamp.now(),
}
];
// Sample Markets Data
const sampleMarkets = [
{
name: 'Mumbai Central Market',
location: {
city: 'Mumbai',
state: 'Maharashtra',
country: 'India',
latitude: 19.0760,
longitude: 72.8777,
address: 'Mumbai Central Market, Mumbai'
},
isActive: true,
marketType: 'wholesale',
operatingHours: {
openTime: '06:00',
closeTime: '18:00',
workingDays: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat']
},
contactInfo: {
phone: '+91-9876543210',
email: 'mumbaimarket@email.com'
},
supportedBreeds: ['CB', 'BV'],
lastUpdated: Timestamp.now(),
createdAt: Timestamp.now()
},
{
name: 'Bangalore Silk Market',
location: {
city: 'Bangalore',
state: 'Karnataka',
country: 'India',
latitude: 12.9716,
longitude: 77.5946,
address: 'Silk Market, Bangalore'
},
isActive: true,
marketType: 'wholesale',
operatingHours: {
openTime: '07:00',
closeTime: '19:00',
workingDays: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat']
},
contactInfo: {
phone: '+91-9876543211',
email: 'bangaloremarket@email.com'
},
supportedBreeds: ['CB', 'BV'],
lastUpdated: Timestamp.now(),
createdAt: Timestamp.now()
},
{
name: 'Ramanagara Cocoon Market',
location: {
city: 'Ramanagara',
state: 'Karnataka',
country: 'India',
latitude: 12.7243,
longitude: 77.2831,
address: 'Cocoon Market, Ramanagara'
},
isActive: true,
marketType: 'auction',
operatingHours: {
openTime: '08:00',
closeTime: '16:00',
workingDays: ['tue', 'thu', 'sat']
},
contactInfo: {
phone: '+91-9876543212',
email: 'ramanagaramarket@email.com'
},
supportedBreeds: ['CB', 'BV'],
lastUpdated: Timestamp.now(),
createdAt: Timestamp.now()
},
{
name: 'Mysore Silk Exchange',
location: {
city: 'Mysore',
state: 'Karnataka',
country: 'India',
latitude: 12.2958,
longitude: 76.6394,
address: 'Silk Exchange, Mysore'
},
isActive: true,
marketType: 'retail',
operatingHours: {
openTime: '09:00',
closeTime: '17:00',
workingDays: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat']
},
contactInfo: {
phone: '+91-9876543213',
email: 'mysoremarket@email.com'
},
supportedBreeds: ['CB', 'BV'],
lastUpdated: Timestamp.now(),
createdAt: Timestamp.now()
}
];
// Sample Breeds Data - CB and BV only
const sampleBreeds = [
{
name: 'Cross Breed (CB)',
scientificName: 'Bombyx mori hybrid',
category: 'CB',
description: 'Cross breed variety with improved disease resistance and yield',
characteristics: {
color: 'white to cream',
size: 'medium to large',
quality: 'high',
production: 'year-round'
},
averagePrice: {
min: 500,
max: 600,
avg: 550
},
productionAreas: ['Karnataka', 'Tamil Nadu', 'Andhra Pradesh', 'Maharashtra'],
seasonality: {
peak: ['March', 'April', 'October', 'November'],
low: ['June', 'July', 'August']
},
isActive: true,
lastUpdated: Timestamp.now(),
createdAt: Timestamp.now()
},
{
name: 'Bivoltine (BV)',
scientificName: 'Bombyx mori bivoltine',
category: 'BV',
description: 'Pure bivoltine variety producing superior quality silk with finer denier',
characteristics: {
color: 'pure white',
size: 'medium',
quality: 'premium',
production: 'seasonal'
},
averagePrice: {
min: 400,
max: 520,
avg: 460
},
productionAreas: ['Karnataka', 'Tamil Nadu', 'Andhra Pradesh', 'West Bengal'],
seasonality: {
peak: ['February', 'March', 'September', 'October'],
low: ['June', 'July', 'August', 'December']
},
isActive: true,
lastUpdated: Timestamp.now(),
createdAt: Timestamp.now()
}
];
export const seedCocoonPrices = async () => {
try {
console.log('π± Seeding CB and BV cocoon prices...');
for (const priceData of sampleCocoonPrices) {
await addDoc(collection(db, COLLECTIONS.COCOON_PRICES), priceData);
console.log(`π Added price for ${priceData.breed} in ${priceData.market}`);
}
console.log('β
Successfully seeded all cocoon prices!');
} catch (error) {
console.error('β Error seeding cocoon prices:', error);
}
};
export const seedMarkets = async () => {
try {
console.log('π± Seeding markets...');
for (const marketData of sampleMarkets) {
await addDoc(collection(db, COLLECTIONS.MARKETS), marketData);
console.log(`πͺ Added market: ${marketData.name}`);
}
console.log('β
Successfully seeded all markets!');
} catch (error) {
console.error('β Error seeding markets:', error);
}
};
export const seedBreeds = async () => {
try {
console.log('π± Seeding CB and BV breeds...');
for (const breedData of sampleBreeds) {
await addDoc(collection(db, COLLECTIONS.BREEDS), breedData);
console.log(`π Added breed: ${breedData.name}`);
}
console.log('β
Successfully seeded all breeds!');
} catch (error) {
console.error('β Error seeding breeds:', error);
}
};
export const seedAllData = async () => {
try {
console.log('π Starting CB and BV data seeding...');
await seedBreeds();
await seedMarkets();
await seedCocoonPrices();
console.log('π All CB and BV data seeded successfully!');
console.log('π± Your cocoon price app is ready to use!');
} catch (error) {
console.error('π₯ Error during data seeding:', error);
}
};
// Uncomment the line below to run complete seeding when you import this file
// seedAllData();