@servicetitan/acquisition-functions 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
@@ -10,15 +10,9 @@ describe('property-assessorlastsaledate-converter', () => {
10
10
  const client = await (0, setup_1.openConnection)();
11
11
  base = client.db('test');
12
12
  await (0, setup_1.setupProperties)(base);
13
- const { filterFetcher } = (0, index_1.configureProcessor)({
13
+ const { filterFetcher, propertyUseGroupProcessor } = (0, index_1.configureProcessor)({
14
14
  workers: 10,
15
15
  mongoDb: base,
16
- fetchProperties: (0, setup_1.getFetchPropertiesForFilters)(base),
17
- });
18
- const { propertyUseGroupProcessor } = (0, index_1.configureProcessor)({
19
- workers: 10,
20
- mongoDb: base,
21
- fetchProperties: (0, setup_1.getFetchPropertiesForFix)(base),
22
16
  });
23
17
  await propertyUseGroupProcessor.start(['90001', '90002']);
24
18
  metadata = await filterFetcher.start(['90001', '90002']);
@@ -0,0 +1,451 @@
1
+ export declare const MOCK: ({
2
+ attomid: number;
3
+ fulladdress: string;
4
+ addressstreet: string;
5
+ addressunit: string;
6
+ primarynumber: number;
7
+ streetname: string;
8
+ streetpredirection: string;
9
+ streetpostdirection: string;
10
+ streetsuffix: string;
11
+ secondarynumber: string;
12
+ secondarydesignator: string;
13
+ extrasecondarynumber: string;
14
+ extrasecondarydesignator: string;
15
+ cityname: string;
16
+ stateabbreviation: string;
17
+ zipcode: string;
18
+ latitude: number;
19
+ longitude: number;
20
+ situsstatecode: string;
21
+ situscounty: string;
22
+ propertyjurisdictionname: string;
23
+ situsstatecountyfips: string;
24
+ combinedstatisticalarea: string;
25
+ cbsaname: string;
26
+ cbsacode: number;
27
+ msaname: string;
28
+ msacode: number;
29
+ metropolitandivision: string;
30
+ minorcivildivisionname: string;
31
+ minorcivildivisioncode: number;
32
+ neighborhoodcode: string;
33
+ censusfipsplacecode: number;
34
+ censustract: number;
35
+ censusblockgroup: number;
36
+ censusblock: number;
37
+ parcelnumberraw: string;
38
+ parcelnumberformatted: string;
39
+ parcelnumberyearadded: number;
40
+ parcelnumberalternate: string;
41
+ parcelmapbook: string;
42
+ parcelmappage: string;
43
+ parcelnumberyearchange: number;
44
+ parcelnumberprevious: number;
45
+ parcelaccountnumber: string;
46
+ propertyaddressfull: string;
47
+ propertyaddresshousenumber: number;
48
+ propertyaddressstreetdirection: string;
49
+ propertyaddressstreetname: string;
50
+ propertyaddressstreetsuffix: string;
51
+ propertyaddressstreetpostdirection: string;
52
+ propertyaddressunitprefix: string;
53
+ propertyaddressunitvalue: string;
54
+ propertyaddresscity: string;
55
+ propertyaddressstate: string;
56
+ propertyaddresszip: number;
57
+ propertyaddresszip4: number;
58
+ propertyaddresscrrt: string;
59
+ propertyaddressinfoprivacy: number;
60
+ congressionaldistricthouse: number;
61
+ legaldescription: string;
62
+ legalrange: string;
63
+ legaltownship: string;
64
+ legalsection: string;
65
+ legalquarter: string;
66
+ legalquarterquarter: string;
67
+ legalsubdivision: number;
68
+ legalphase: string;
69
+ legaltractnumber: number;
70
+ legalblock1: string;
71
+ legalblock2: string;
72
+ legallotnumber1: number;
73
+ legallotnumber2: string;
74
+ legallotnumber3: string;
75
+ legalunit: string;
76
+ partyowner1namefull: string;
77
+ partyowner1namefirst: string;
78
+ partyowner1namemiddle: string;
79
+ partyowner1namelast: string;
80
+ partyowner1namesuffix: string;
81
+ trustdescription: string;
82
+ companyflag: string;
83
+ partyowner2namefull: string;
84
+ partyowner2namefirst: string;
85
+ partyowner2namemiddle: string;
86
+ partyowner2namelast: string;
87
+ partyowner2namesuffix: string;
88
+ ownertypedescription1: string;
89
+ ownershipvestingrelationcode: string;
90
+ partyowner3namefull: string;
91
+ partyowner3namefirst: string;
92
+ partyowner3namemiddle: string;
93
+ partyowner3namelast: string;
94
+ partyowner3namesuffix: string;
95
+ partyowner4namefull: string;
96
+ partyowner4namefirst: string;
97
+ partyowner4namemiddle: string;
98
+ partyowner4namelast: string;
99
+ partyowner4namesuffix: string;
100
+ ownertypedescription2: string;
101
+ contactownermailingcounty: string;
102
+ contactownermailingfips: string;
103
+ contactownermailaddressfull: string;
104
+ contactownermailaddresshousenumber: number;
105
+ contactownermailaddressstreetdirection: string;
106
+ contactownermailaddressstreetname: string;
107
+ contactownermailaddressstreetsuffix: string;
108
+ contactownermailaddressstreetpostdirection: string;
109
+ contactownermailaddressunitprefix: string;
110
+ contactownermailaddressunit: string;
111
+ contactownermailaddresscity: string;
112
+ contactownermailaddressstate: string;
113
+ contactownermailaddresszip: number;
114
+ contactownermailaddresszip4: number;
115
+ contactownermailaddresscrrt: string;
116
+ contactownermailaddressinfoformat: string;
117
+ contactownermailinfoprivacy: string;
118
+ statusowneroccupiedflag: string;
119
+ deedowner1namefull: string;
120
+ deedowner1namefirst: string;
121
+ deedowner1namemiddle: string;
122
+ deedowner1namelast: string;
123
+ deedowner1namesuffix: string;
124
+ deedowner2namefull: string;
125
+ deedowner2namefirst: string;
126
+ deedowner2namemiddle: string;
127
+ deedowner2namelast: string;
128
+ deedowner2namesuffix: string;
129
+ deedowner3namefull: string;
130
+ deedowner3namefirst: string;
131
+ deedowner3namemiddle: string;
132
+ deedowner3namelast: string;
133
+ deedowner3namesuffix: string;
134
+ deedowner4namefull: string;
135
+ deedowner4namefirst: string;
136
+ deedowner4namemiddle: string;
137
+ deedowner4namelast: string;
138
+ deedowner4namesuffix: string;
139
+ taxyearassessed: number;
140
+ taxassessedvaluetotal: number;
141
+ taxassessedvalueimprovements: number;
142
+ taxassessedvalueland: number;
143
+ taxassessedimprovementsperc: number;
144
+ previousassessedvalue: number;
145
+ taxmarketvalueyear: number;
146
+ taxmarketvaluetotal: number;
147
+ taxmarketvalueimprovements: number;
148
+ taxmarketvalueland: number;
149
+ taxmarketimprovementsperc: number;
150
+ taxfiscalyear: number;
151
+ taxratearea: string;
152
+ taxbilledamount: number;
153
+ taxdelinquentyear: number;
154
+ lastassessortaxrollupdate: string;
155
+ assrlastupdated: string;
156
+ taxexemptionadditional: string;
157
+ yearbuilt: number;
158
+ yearbuilteffective: number;
159
+ zonedcodelocal: string;
160
+ propertyusemuni: string;
161
+ propertyusegroup: string;
162
+ propertyusestandardized: string;
163
+ assessorlastsaledate: string;
164
+ assessorlastsaleamount: number;
165
+ assessorpriorsaledate: string;
166
+ assessorpriorsaleamount: number;
167
+ lastownershiptransferdate: string;
168
+ lastownershiptransferdocumentnumber: string;
169
+ lastownershiptransfertransactionid: number;
170
+ deedlastsaledocumentbook: string;
171
+ deedlastsaledocumentpage: string;
172
+ deedlastdocumentnumber: string;
173
+ deedlastsaledate: string;
174
+ deedlastsaleprice: number;
175
+ deedlastsaletransactionid: number;
176
+ areabuilding: number;
177
+ areabuildingdefinitioncode: string;
178
+ areagross: number;
179
+ area1stfloor: number;
180
+ area2ndfloor: number;
181
+ areaupperfloors: number;
182
+ arealotacres: number;
183
+ arealotsf: number;
184
+ arealotdepth: number;
185
+ arealotwidth: number;
186
+ roomsatticarea: number;
187
+ roomsatticflag: number;
188
+ roomsbasementarea: number;
189
+ roomsbasementareafinished: number;
190
+ roomsbasementareaunfinished: number;
191
+ parkinggarage: string;
192
+ parkinggaragearea: number;
193
+ parkingcarport: number;
194
+ parkingcarportarea: number;
195
+ hvaccoolingdetail: string;
196
+ hvacheatingdetail: string;
197
+ hvacheatingfuel: string;
198
+ utilitiessewageusage: string;
199
+ utilitieswatersource: string;
200
+ utilitiesmobilehomehookupflag: string;
201
+ foundation: string;
202
+ construction: string;
203
+ interiorstructure: string;
204
+ plumbingfixturescount: number;
205
+ constructionfireresistanceclass: string;
206
+ assafetyfiresprinklersflag: string;
207
+ flooringmaterialprimary: string;
208
+ bathcount: number;
209
+ bathpartialcount: number;
210
+ bedroomscount: number;
211
+ roomscount: number;
212
+ storiescount: number;
213
+ unitscount: number;
214
+ fireplace: string;
215
+ fireplacecount: number;
216
+ structurestyle: string;
217
+ exterior1code: string;
218
+ roofmaterial: string;
219
+ roofconstruction: string;
220
+ porchcode: string;
221
+ pool: string;
222
+ poolarea: number;
223
+ buildingscount: number;
224
+ modifiedon: string;
225
+ location: string;
226
+ } | {
227
+ attomid: number;
228
+ fulladdress: string;
229
+ addressstreet: string;
230
+ addressunit: string;
231
+ primarynumber: number;
232
+ streetname: string;
233
+ streetpredirection: string;
234
+ streetpostdirection: string;
235
+ streetsuffix: string;
236
+ secondarynumber: string;
237
+ secondarydesignator: string;
238
+ extrasecondarynumber: string;
239
+ extrasecondarydesignator: string;
240
+ cityname: string;
241
+ stateabbreviation: string;
242
+ zipcode: string;
243
+ latitude: number;
244
+ longitude: number;
245
+ situsstatecode: string;
246
+ situscounty: string;
247
+ propertyjurisdictionname: string;
248
+ situsstatecountyfips: string;
249
+ combinedstatisticalarea: string;
250
+ cbsaname: string;
251
+ cbsacode: number;
252
+ msaname: string;
253
+ msacode: number;
254
+ metropolitandivision: string;
255
+ minorcivildivisionname: string;
256
+ minorcivildivisioncode: number;
257
+ neighborhoodcode: string;
258
+ censusfipsplacecode: number;
259
+ censustract: number;
260
+ censusblockgroup: number;
261
+ censusblock: number;
262
+ parcelnumberraw: string;
263
+ parcelnumberformatted: string;
264
+ parcelnumberyearadded: number;
265
+ parcelnumberalternate: string;
266
+ parcelmapbook: string;
267
+ parcelmappage: string;
268
+ parcelnumberyearchange: number;
269
+ parcelnumberprevious: string;
270
+ parcelaccountnumber: string;
271
+ propertyaddressfull: string;
272
+ propertyaddresshousenumber: number;
273
+ propertyaddressstreetdirection: string;
274
+ propertyaddressstreetname: string;
275
+ propertyaddressstreetsuffix: string;
276
+ propertyaddressstreetpostdirection: string;
277
+ propertyaddressunitprefix: string;
278
+ propertyaddressunitvalue: string;
279
+ propertyaddresscity: string;
280
+ propertyaddressstate: string;
281
+ propertyaddresszip: number;
282
+ propertyaddresszip4: string;
283
+ propertyaddresscrrt: string;
284
+ propertyaddressinfoprivacy: number;
285
+ congressionaldistricthouse: number;
286
+ legaldescription: string;
287
+ legalrange: string;
288
+ legaltownship: string;
289
+ legalsection: string;
290
+ legalquarter: string;
291
+ legalquarterquarter: string;
292
+ legalsubdivision: number;
293
+ legalphase: string;
294
+ legaltractnumber: number;
295
+ legalblock1: string;
296
+ legalblock2: string;
297
+ legallotnumber1: number;
298
+ legallotnumber2: string;
299
+ legallotnumber3: string;
300
+ legalunit: string;
301
+ partyowner1namefull: string;
302
+ partyowner1namefirst: string;
303
+ partyowner1namemiddle: string;
304
+ partyowner1namelast: string;
305
+ partyowner1namesuffix: string;
306
+ trustdescription: string;
307
+ companyflag: string;
308
+ partyowner2namefull: string;
309
+ partyowner2namefirst: string;
310
+ partyowner2namemiddle: string;
311
+ partyowner2namelast: string;
312
+ partyowner2namesuffix: string;
313
+ ownertypedescription1: string;
314
+ ownershipvestingrelationcode: string;
315
+ partyowner3namefull: string;
316
+ partyowner3namefirst: string;
317
+ partyowner3namemiddle: string;
318
+ partyowner3namelast: string;
319
+ partyowner3namesuffix: string;
320
+ partyowner4namefull: string;
321
+ partyowner4namefirst: string;
322
+ partyowner4namemiddle: string;
323
+ partyowner4namelast: string;
324
+ partyowner4namesuffix: string;
325
+ ownertypedescription2: string;
326
+ contactownermailingcounty: string;
327
+ contactownermailingfips: string;
328
+ contactownermailaddressfull: string;
329
+ contactownermailaddresshousenumber: number;
330
+ contactownermailaddressstreetdirection: string;
331
+ contactownermailaddressstreetname: string;
332
+ contactownermailaddressstreetsuffix: string;
333
+ contactownermailaddressstreetpostdirection: string;
334
+ contactownermailaddressunitprefix: string;
335
+ contactownermailaddressunit: string;
336
+ contactownermailaddresscity: string;
337
+ contactownermailaddressstate: string;
338
+ contactownermailaddresszip: number;
339
+ contactownermailaddresszip4: number;
340
+ contactownermailaddresscrrt: string;
341
+ contactownermailaddressinfoformat: string;
342
+ contactownermailinfoprivacy: string;
343
+ statusowneroccupiedflag: string;
344
+ deedowner1namefull: string;
345
+ deedowner1namefirst: string;
346
+ deedowner1namemiddle: string;
347
+ deedowner1namelast: string;
348
+ deedowner1namesuffix: string;
349
+ deedowner2namefull: string;
350
+ deedowner2namefirst: string;
351
+ deedowner2namemiddle: string;
352
+ deedowner2namelast: string;
353
+ deedowner2namesuffix: string;
354
+ deedowner3namefull: string;
355
+ deedowner3namefirst: string;
356
+ deedowner3namemiddle: string;
357
+ deedowner3namelast: string;
358
+ deedowner3namesuffix: string;
359
+ deedowner4namefull: string;
360
+ deedowner4namefirst: string;
361
+ deedowner4namemiddle: string;
362
+ deedowner4namelast: string;
363
+ deedowner4namesuffix: string;
364
+ taxyearassessed: number;
365
+ taxassessedvaluetotal: number;
366
+ taxassessedvalueimprovements: number;
367
+ taxassessedvalueland: number;
368
+ taxassessedimprovementsperc: number;
369
+ previousassessedvalue: number;
370
+ taxmarketvalueyear: number;
371
+ taxmarketvaluetotal: number;
372
+ taxmarketvalueimprovements: number;
373
+ taxmarketvalueland: number;
374
+ taxmarketimprovementsperc: number;
375
+ taxfiscalyear: number;
376
+ taxratearea: string;
377
+ taxbilledamount: number;
378
+ taxdelinquentyear: number;
379
+ lastassessortaxrollupdate: string;
380
+ assrlastupdated: string;
381
+ taxexemptionadditional: string;
382
+ yearbuilt: number;
383
+ yearbuilteffective: number;
384
+ zonedcodelocal: string;
385
+ propertyusemuni: number;
386
+ propertyusegroup: string;
387
+ propertyusestandardized: string;
388
+ assessorlastsaledate: null;
389
+ assessorlastsaleamount: number;
390
+ assessorpriorsaledate: null;
391
+ assessorpriorsaleamount: number;
392
+ lastownershiptransferdate: string;
393
+ lastownershiptransferdocumentnumber: string;
394
+ lastownershiptransfertransactionid: number;
395
+ deedlastsaledocumentbook: string;
396
+ deedlastsaledocumentpage: string;
397
+ deedlastdocumentnumber: string;
398
+ deedlastsaledate: null;
399
+ deedlastsaleprice: number;
400
+ deedlastsaletransactionid: number;
401
+ areabuilding: number;
402
+ areabuildingdefinitioncode: string;
403
+ areagross: number;
404
+ area1stfloor: number;
405
+ area2ndfloor: number;
406
+ areaupperfloors: number;
407
+ arealotacres: number;
408
+ arealotsf: number;
409
+ arealotdepth: number;
410
+ arealotwidth: number;
411
+ roomsatticarea: number;
412
+ roomsatticflag: number;
413
+ roomsbasementarea: number;
414
+ roomsbasementareafinished: number;
415
+ roomsbasementareaunfinished: number;
416
+ parkinggarage: string;
417
+ parkinggaragearea: number;
418
+ parkingcarport: number;
419
+ parkingcarportarea: number;
420
+ hvaccoolingdetail: string;
421
+ hvacheatingdetail: string;
422
+ hvacheatingfuel: string;
423
+ utilitiessewageusage: string;
424
+ utilitieswatersource: string;
425
+ utilitiesmobilehomehookupflag: string;
426
+ foundation: string;
427
+ construction: string;
428
+ interiorstructure: string;
429
+ plumbingfixturescount: number;
430
+ constructionfireresistanceclass: number;
431
+ assafetyfiresprinklersflag: string;
432
+ flooringmaterialprimary: string;
433
+ bathcount: number;
434
+ bathpartialcount: number;
435
+ bedroomscount: number;
436
+ roomscount: number;
437
+ storiescount: number;
438
+ unitscount: number;
439
+ fireplace: string;
440
+ fireplacecount: number;
441
+ structurestyle: string;
442
+ exterior1code: string;
443
+ roofmaterial: string;
444
+ roofconstruction: string;
445
+ porchcode: string;
446
+ pool: string;
447
+ poolarea: number;
448
+ buildingscount: number;
449
+ modifiedon: string;
450
+ location: string;
451
+ })[];
@@ -0,0 +1 @@
1
+ export {};
@@ -17,7 +17,6 @@ describe('property-use-group-converter', () => {
17
17
  processor = (0, index_1.configureProcessor)({
18
18
  workers: 1,
19
19
  mongoDb: base,
20
- fetchProperties: (0, setup_1.getFetchPropertiesForFix)(base),
21
20
  });
22
21
  const { propertyUseGroupProcessor } = processor;
23
22
  metadata = await propertyUseGroupProcessor.start('90001');
@@ -0,0 +1,4 @@
1
+ import { Db, MongoClient } from 'mongodb';
2
+ export declare function setupProperties(base: Db): Promise<void>;
3
+ export declare const openConnection: () => Promise<MongoClient>;
4
+ export declare const closeConnection: () => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFetchPropertiesForFix = exports.getFetchPropertiesForFilters = exports.closeConnection = exports.openConnection = exports.setupProperties = void 0;
3
+ exports.closeConnection = exports.openConnection = exports.setupProperties = void 0;
4
4
  const mongodb_1 = require("mongodb");
5
5
  const mock_1 = require("./mock");
6
6
  async function setupProperties(base) {
@@ -39,32 +39,3 @@ const openConnection = async () => {
39
39
  exports.openConnection = openConnection;
40
40
  const closeConnection = () => connectedMongoClient?.close();
41
41
  exports.closeConnection = closeConnection;
42
- const getFetchPropertiesForFilters = (base) => async (zip) => {
43
- return base
44
- .collection('properties')
45
- .find({ zipcode: zip }, {
46
- projection: {
47
- zipcode: 1,
48
- propertyusegroup: 1,
49
- propertyusestandardized: 1,
50
- hvaccoolingdetail: 1,
51
- hvacheatingdetail: 1,
52
- utilitieswatersource: 1,
53
- flooringmaterialprimary: 1,
54
- _id: 0, // eslint-disable-line
55
- },
56
- })
57
- .toArray();
58
- };
59
- exports.getFetchPropertiesForFilters = getFetchPropertiesForFilters;
60
- const getFetchPropertiesForFix = (base) => async (zip) => {
61
- return base
62
- .collection('properties')
63
- .find({ zipcode: zip }, {
64
- projection: {
65
- propertyusegroup: 1,
66
- },
67
- })
68
- .toArray();
69
- };
70
- exports.getFetchPropertiesForFix = getFetchPropertiesForFix;
@@ -0,0 +1,28 @@
1
+ import { Property } from '../types';
2
+ export declare const calculateFilterCount: (properties: Property[]) => {
3
+ propertyusegroupCounts: {
4
+ name: string;
5
+ count: number;
6
+ }[];
7
+ propertyusestandardizedCounts: {
8
+ name: string;
9
+ groupName: string;
10
+ count: number;
11
+ }[];
12
+ hvaccoolingdetailCounts: {
13
+ name: string;
14
+ count: number;
15
+ }[];
16
+ hvacheatingdetailCounts: {
17
+ name: string;
18
+ count: number;
19
+ }[];
20
+ utilitieswatersourceCounts: {
21
+ name: string;
22
+ count: number;
23
+ }[];
24
+ flooringmaterialprimaryCounts: {
25
+ name: string;
26
+ count: number;
27
+ }[];
28
+ };
@@ -0,0 +1,7 @@
1
+ import { Db } from 'mongodb';
2
+ export declare function getFilterFetcherProcessor(db: Db): (zip: string, errors: Set<string>) => Promise<{
3
+ requests: number;
4
+ errors: number;
5
+ properties: number;
6
+ filters: number;
7
+ }>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFilterFetcherProcessor = void 0;
4
4
  const calc_filter_count_1 = require("./calc-filter-count");
5
- function getFilterFetcherProcessor({ mongoDb: db, fetchProperties }) {
5
+ function getFilterFetcherProcessor(db) {
6
6
  const getFiltersCollection = async () => {
7
7
  return db.collection('filters');
8
8
  };
@@ -22,6 +22,23 @@ function getFilterFetcherProcessor({ mongoDb: db, fetchProperties }) {
22
22
  flooringmaterialprimary: flooringmaterialprimaryCounts,
23
23
  });
24
24
  };
25
+ const getProperties = (zip) => {
26
+ return db
27
+ .collection('properties')
28
+ .find({ zipcode: zip }, {
29
+ projection: {
30
+ zipcode: 1,
31
+ propertyusegroup: 1,
32
+ propertyusestandardized: 1,
33
+ hvaccoolingdetail: 1,
34
+ hvacheatingdetail: 1,
35
+ utilitieswatersource: 1,
36
+ flooringmaterialprimary: 1,
37
+ _id: 0, // eslint-disable-line
38
+ },
39
+ })
40
+ .toArray();
41
+ };
25
42
  return async function processZip(zip, errors) {
26
43
  const meta = {
27
44
  requests: 0,
@@ -33,7 +50,7 @@ function getFilterFetcherProcessor({ mongoDb: db, fetchProperties }) {
33
50
  return meta;
34
51
  }
35
52
  try {
36
- const properties = await fetchProperties(zip);
53
+ const properties = await getProperties(zip);
37
54
  meta.requests += 1;
38
55
  meta.properties += properties.length;
39
56
  const filters = (0, calc_filter_count_1.calculateFilterCount)(properties);
@@ -50,6 +67,7 @@ function getFilterFetcherProcessor({ mongoDb: db, fetchProperties }) {
50
67
  console.error(e);
51
68
  errors.add(zip);
52
69
  meta.errors += 1;
70
+ throw e;
53
71
  }
54
72
  return meta;
55
73
  };
@@ -0,0 +1,7 @@
1
+ import type { Db } from 'mongodb';
2
+ export declare function getPropertyUseGroupProcessor(db: Db): (zip: string, errors: Set<string>) => Promise<{
3
+ requests: number;
4
+ errors: number;
5
+ properties: number;
6
+ }>;
7
+ export declare function propertyUseGroupProcessorAggregate(db: Db): Promise<void>;
@@ -8,7 +8,7 @@ const getPropertiesCollection = async (db) => {
8
8
  function fixPropertyName(propertyName) {
9
9
  return propertyName ? propertyName.toUpperCase() : '';
10
10
  }
11
- function getPropertyUseGroupProcessor({ mongoDb: db, fetchProperties }) {
11
+ function getPropertyUseGroupProcessor(db) {
12
12
  function fixPropertyNames(properties) {
13
13
  return properties
14
14
  .filter(p => p.propertyusegroup &&
@@ -32,6 +32,16 @@ function getPropertyUseGroupProcessor({ mongoDb: db, fetchProperties }) {
32
32
  }));
33
33
  return collection.bulkWrite(propQuery, { ordered: true, w: 1 });
34
34
  };
35
+ const getProperties = (zip) => {
36
+ return db
37
+ .collection('properties')
38
+ .find({ zipcode: zip }, {
39
+ projection: {
40
+ propertyusegroup: 1,
41
+ },
42
+ })
43
+ .toArray();
44
+ };
35
45
  return async function processZip(zip, errors) {
36
46
  const meta = {
37
47
  requests: 0,
@@ -42,7 +52,7 @@ function getPropertyUseGroupProcessor({ mongoDb: db, fetchProperties }) {
42
52
  return meta;
43
53
  }
44
54
  try {
45
- const properties = await fetchProperties(zip);
55
+ const properties = await getProperties(zip);
46
56
  meta.requests += 1;
47
57
  if (!properties?.length) {
48
58
  return meta;
@@ -59,6 +69,7 @@ function getPropertyUseGroupProcessor({ mongoDb: db, fetchProperties }) {
59
69
  console.error(e);
60
70
  errors.add(zip);
61
71
  meta.errors += 1;
72
+ throw e;
62
73
  }
63
74
  return meta;
64
75
  };
@@ -0,0 +1,27 @@
1
+ import type { Db } from 'mongodb';
2
+ import { Property } from './types';
3
+ export interface Config {
4
+ workers: number;
5
+ mongoDb: Db;
6
+ fetchProperties?: (zip: string) => Promise<Property[]>;
7
+ }
8
+ export declare function configureProcessor(config: Config): {
9
+ filterFetcher: {
10
+ getProcessor: () => AsyncGenerator<import("./zip-processor").ResultsMeta | import("./zip-processor").ResultsMeta[], void, unknown> | null;
11
+ start: (zips: string | [from: string, to: string]) => Promise<Required<import("./zip-processor").ResultsMeta>>;
12
+ clear: () => Promise<void>;
13
+ };
14
+ assessorLastSaleDateProcessor: {
15
+ getProcessor: () => AsyncGenerator<import("./zip-processor").ResultsMeta | import("./zip-processor").ResultsMeta[], void, unknown> | null;
16
+ start: (zips: string | [from: string, to: string]) => Promise<Required<import("./zip-processor").ResultsMeta>>;
17
+ clear: () => Promise<void>;
18
+ };
19
+ propertyUseGroupProcessor: {
20
+ getProcessor: () => AsyncGenerator<import("./zip-processor").ResultsMeta | import("./zip-processor").ResultsMeta[], void, unknown> | null;
21
+ start: (zips: string | [from: string, to: string]) => Promise<Required<import("./zip-processor").ResultsMeta>>;
22
+ clear: () => Promise<void>;
23
+ };
24
+ };
25
+ export * from './fix-property-use';
26
+ export * from './property-assessorlastsaledate-converter';
27
+ export * from './filter-fetcher';
package/dist/index.js CHANGED
@@ -1,18 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertiesAssessorLastSaleDateAggregate = exports.propertyUseGroupProcessorAggregate = exports.configureProcessor = void 0;
17
+ exports.configureProcessor = void 0;
4
18
  const filter_fetcher_1 = require("./filter-fetcher");
5
19
  const fix_property_use_1 = require("./fix-property-use");
6
20
  const property_assessorlastsaledate_converter_1 = require("./property-assessorlastsaledate-converter");
7
21
  const zip_processor_1 = require("./zip-processor");
8
22
  function configureProcessor(config) {
9
- const filterFetcher = (0, zip_processor_1.zipProcessor)(config, (0, filter_fetcher_1.getFilterFetcherProcessor)(config));
10
- const assessorLastSaleDateProcessor = (0, zip_processor_1.zipProcessor)(config, (0, property_assessorlastsaledate_converter_1.getAssessorLastSaleDateProcessor)(config.mongoDb));
11
- const propertyUseGroupProcessor = (0, zip_processor_1.zipProcessor)(config, (0, fix_property_use_1.getPropertyUseGroupProcessor)(config));
23
+ const filterFetcher = (0, zip_processor_1.zipProcessor)(config.workers, (0, filter_fetcher_1.getFilterFetcherProcessor)(config.mongoDb));
24
+ const assessorLastSaleDateProcessor = (0, zip_processor_1.zipProcessor)(config.workers, (0, property_assessorlastsaledate_converter_1.getAssessorLastSaleDateProcessor)(config.mongoDb));
25
+ const propertyUseGroupProcessor = (0, zip_processor_1.zipProcessor)(config.workers, (0, fix_property_use_1.getPropertyUseGroupProcessor)(config.mongoDb));
12
26
  return { filterFetcher, assessorLastSaleDateProcessor, propertyUseGroupProcessor };
13
27
  }
14
28
  exports.configureProcessor = configureProcessor;
15
- var fix_property_use_2 = require("./fix-property-use");
16
- Object.defineProperty(exports, "propertyUseGroupProcessorAggregate", { enumerable: true, get: function () { return fix_property_use_2.propertyUseGroupProcessorAggregate; } });
17
- var property_assessorlastsaledate_converter_2 = require("./property-assessorlastsaledate-converter");
18
- Object.defineProperty(exports, "propertiesAssessorLastSaleDateAggregate", { enumerable: true, get: function () { return property_assessorlastsaledate_converter_2.propertiesAssessorLastSaleDateAggregate; } });
29
+ __exportStar(require("./fix-property-use"), exports);
30
+ __exportStar(require("./property-assessorlastsaledate-converter"), exports);
31
+ __exportStar(require("./filter-fetcher"), exports);
@@ -0,0 +1,7 @@
1
+ import type { Db } from 'mongodb';
2
+ export declare function getAssessorLastSaleDateProcessor(db: Db): (zip: string, errors: Set<string>) => Promise<{
3
+ requests: number;
4
+ errors: number;
5
+ properties: number;
6
+ }>;
7
+ export declare function propertiesAssessorLastSaleDateAggregate(db: Db): Promise<void>;
@@ -60,6 +60,7 @@ function getAssessorLastSaleDateProcessor(db) {
60
60
  console.error(e);
61
61
  meta.errors += 1;
62
62
  errors.add(zip);
63
+ throw e;
63
64
  }
64
65
  return meta;
65
66
  };
@@ -0,0 +1,243 @@
1
+ import type { WithId } from 'mongodb';
2
+ export declare type Property = WithId<{
3
+ attomid: number;
4
+ fulladdress: string;
5
+ addressstreet: string;
6
+ addressunit: string;
7
+ primarynumber: number;
8
+ streetname: string;
9
+ streetpredirection?: string;
10
+ streetpostdirection?: string;
11
+ streetsuffix: string;
12
+ secondarynumber?: number;
13
+ secondarydesignator: string;
14
+ extrasecondarynumber?: number;
15
+ extrasecondarydesignator?: string;
16
+ cityname: string;
17
+ stateabbreviation: string;
18
+ zipcode: string;
19
+ latitude: number;
20
+ longitude: number;
21
+ situsstatecode: string;
22
+ situscounty: string;
23
+ propertyjurisdictionname: string;
24
+ situsstatecountyfips: number;
25
+ combinedstatisticalarea: string;
26
+ cbsaname: string;
27
+ cbsacode: number;
28
+ msaname: string;
29
+ msacode: number;
30
+ metropolitandivision: string;
31
+ minorcivildivisionname: string;
32
+ minorcivildivisioncode: number;
33
+ neighborhoodcode: string;
34
+ censusfipsplacecode: number;
35
+ censustract: number;
36
+ censusblockgroup: number;
37
+ censusblock: number;
38
+ parcelnumberraw: string;
39
+ parcelnumberformatted: string;
40
+ parcelnumberyearadded: number;
41
+ parcelnumberalternate: string;
42
+ parcelmapbook: string;
43
+ parcelmappage: string;
44
+ parcelnumberyearchange: number;
45
+ parcelnumberprevious: string;
46
+ parcelaccountnumber: string;
47
+ propertyaddressfull: string;
48
+ propertyaddresshousenumber: number;
49
+ propertyaddressstreetdirection: string;
50
+ propertyaddressstreetname: string;
51
+ propertyaddressstreetsuffix: string;
52
+ propertyaddressstreetpostdirection: string;
53
+ propertyaddressunitprefix: string;
54
+ propertyaddressunitvalue: string;
55
+ propertyaddresscity: string;
56
+ propertyaddressstate: string;
57
+ propertyaddresszip: number;
58
+ propertyaddresszip4: number;
59
+ propertyaddresscrrt: string;
60
+ propertyaddressinfoprivacy: number;
61
+ congressionaldistricthouse: number;
62
+ legaldescription: string;
63
+ legalrange: string;
64
+ legaltownship: string;
65
+ legalsection: number;
66
+ legalquarter: string;
67
+ legalquarterquarter: string;
68
+ legalsubdivision: string;
69
+ legalphase: string;
70
+ legaltractnumber: number;
71
+ legalblock1: number;
72
+ legalblock2: string;
73
+ legallotnumber1: number;
74
+ legallotnumber2: string;
75
+ legallotnumber3: string;
76
+ legalunit: number;
77
+ partyowner1namefull: string;
78
+ partyowner1namefirst: string;
79
+ partyowner1namemiddle: string;
80
+ partyowner1namelast: string;
81
+ partyowner1namesuffix: string;
82
+ trustdescription: string;
83
+ companyflag: string;
84
+ partyowner2namefull: string;
85
+ partyowner2namefirst: string;
86
+ partyowner2namemiddle: string;
87
+ partyowner2namelast: string;
88
+ partyowner2namesuffix: string;
89
+ ownertypedescription1: string;
90
+ ownershipvestingrelationcode: string;
91
+ partyowner3namefull: string;
92
+ partyowner3namefirst: string;
93
+ partyowner3namemiddle: string;
94
+ partyowner3namelast: string;
95
+ partyowner3namesuffix: string;
96
+ partyowner4namefull: string;
97
+ partyowner4namefirst: string;
98
+ partyowner4namemiddle: string;
99
+ partyowner4namelast: string;
100
+ partyowner4namesuffix: string;
101
+ ownertypedescription2: string;
102
+ contactownermailingcounty: string;
103
+ contactownermailingfips: number;
104
+ contactownermailaddressfull: string;
105
+ contactownermailaddresshousenumber: number;
106
+ contactownermailaddressstreetdirection: string;
107
+ contactownermailaddressstreetname: string;
108
+ contactownermailaddressstreetsuffix: string;
109
+ contactownermailaddressstreetpostdirection: string;
110
+ contactownermailaddressunitprefix: string;
111
+ contactownermailaddressunit: string;
112
+ contactownermailaddresscity: string;
113
+ contactownermailaddressstate: string;
114
+ contactownermailaddresszip: number;
115
+ contactownermailaddresszip4: number;
116
+ contactownermailaddresscrrt: string;
117
+ contactownermailaddressinfoformat: string;
118
+ contactownermailinfoprivacy: string;
119
+ statusowneroccupiedflag: string;
120
+ deedowner1namefull: string;
121
+ deedowner1namefirst: string;
122
+ deedowner1namemiddle: string;
123
+ deedowner1namelast: string;
124
+ deedowner1namesuffix: string;
125
+ deedowner2namefull: string;
126
+ deedowner2namefirst: string;
127
+ deedowner2namemiddle: string;
128
+ deedowner2namelast: string;
129
+ deedowner2namesuffix: string;
130
+ deedowner3namefull: string;
131
+ deedowner3namefirst: string;
132
+ deedowner3namemiddle: string;
133
+ deedowner3namelast: string;
134
+ deedowner3namesuffix: string;
135
+ deedowner4namefull: string;
136
+ deedowner4namefirst: string;
137
+ deedowner4namemiddle: string;
138
+ deedowner4namelast: string;
139
+ deedowner4namesuffix: string;
140
+ taxyearassessed: number;
141
+ taxassessedvaluetotal: number;
142
+ taxassessedvalueimprovements: number;
143
+ taxassessedvalueland: number;
144
+ taxassessedimprovementsperc: number;
145
+ previousassessedvalue: number;
146
+ taxmarketvalueyear: number;
147
+ taxmarketvaluetotal: number;
148
+ taxmarketvalueimprovements: number;
149
+ taxmarketvalueland: number;
150
+ taxmarketimprovementsperc: number;
151
+ taxfiscalyear: number;
152
+ taxratearea: string;
153
+ taxbilledamount: number;
154
+ taxdelinquentyear: number;
155
+ lastassessortaxrollupdate: string;
156
+ assrlastupdated: string;
157
+ taxexemptionadditional: string;
158
+ yearbuilt: number;
159
+ yearbuilteffective: number;
160
+ zonedcodelocal: string;
161
+ propertyusemuni: string;
162
+ propertyusegroup: string;
163
+ propertyusestandardized: string;
164
+ assessorlastsaledate: Date;
165
+ assessorlastsaleamount: number;
166
+ assessorpriorsaledate: null;
167
+ assessorpriorsaleamount: number;
168
+ lastownershiptransferdate: string;
169
+ lastownershiptransferdocumentnumber: string;
170
+ lastownershiptransfertransactionid: number;
171
+ deedlastsaledocumentbook: string;
172
+ deedlastsaledocumentpage: string;
173
+ deedlastdocumentnumber: string;
174
+ deedlastsaledate: string;
175
+ deedlastsaleprice: number;
176
+ deedlastsaletransactionid: number;
177
+ areabuilding: number;
178
+ areabuildingdefinitioncode: string;
179
+ areagross: number;
180
+ area1stfloor: number;
181
+ area2ndfloor: number;
182
+ areaupperfloors: number;
183
+ arealotacres: number;
184
+ arealotsf: number;
185
+ arealotdepth: number;
186
+ arealotwidth: number;
187
+ roomsatticarea: number;
188
+ roomsatticflag: number;
189
+ roomsbasementarea: number;
190
+ roomsbasementareafinished: number;
191
+ roomsbasementareaunfinished: number;
192
+ parkinggarage: string;
193
+ parkinggaragearea: number;
194
+ parkingcarport: number;
195
+ parkingcarportarea: number;
196
+ hvaccoolingdetail: string;
197
+ hvacheatingdetail: string;
198
+ hvacheatingfuel: string;
199
+ utilitiessewageusage: string;
200
+ utilitieswatersource: string;
201
+ utilitiesmobilehomehookupflag: string;
202
+ foundation: string;
203
+ construction: string;
204
+ interiorstructure: string;
205
+ plumbingfixturescount: number;
206
+ constructionfireresistanceclass: string;
207
+ assafetyfiresprinklersflag: string;
208
+ flooringmaterialprimary: string;
209
+ bathcount: number;
210
+ bathpartialcount: number;
211
+ bedroomscount: number;
212
+ roomscount: number;
213
+ storiescount: number;
214
+ unitscount: number;
215
+ fireplace: string;
216
+ fireplacecount: number;
217
+ structurestyle: string;
218
+ exterior1code: string;
219
+ roofmaterial: string;
220
+ roofconstruction: string;
221
+ porchcode: string;
222
+ pool: string;
223
+ poolarea: number;
224
+ buildingscount: number;
225
+ modifiedon: string;
226
+ location: string;
227
+ }>;
228
+ export interface Group {
229
+ name: string;
230
+ count: number;
231
+ }
232
+ export interface GroupNamed extends Group {
233
+ groupName: string;
234
+ }
235
+ export declare type Filter = WithId<{
236
+ zipcode: string;
237
+ propertyusegroup: Group[];
238
+ propertyusestandardized: GroupNamed[];
239
+ hvaccoolingdetail: Group[];
240
+ hvacheatingdetail: Group[];
241
+ utilitieswatersource: Group[];
242
+ flooringmaterialprimary: Group[];
243
+ }>;
@@ -0,0 +1,245 @@
1
+ import { Property } from '../types';
2
+ export declare const SEPARATOR_CHARACTER = "___";
3
+ export declare const UNKNOWN = "unknown";
4
+ export declare const isNotFullProperty: (property: Property) => boolean;
5
+ export declare const isEmptyField: (field: string) => boolean;
6
+ export declare const extractUniqueFilterNames: (properties: Property[]) => {
7
+ propertyUseObjects: {
8
+ name: string;
9
+ typeName: string;
10
+ }[];
11
+ propertyTypeNames: string[];
12
+ hvacCoolingSystemNames: string[];
13
+ hvacHeatingSystemNames: string[];
14
+ waterSourceNames: string[];
15
+ flooringMaterialsNames: string[];
16
+ };
17
+ export declare const convertObjectToArray: <T extends Record<string, unknown>>(obj: T) => T[keyof T][];
18
+ export declare const convertToZipString: (zipNumber: number) => string;
19
+ export declare const convertStringToDate: (props: Property[], propName: keyof Property) => {
20
+ attomid: number;
21
+ fulladdress: string;
22
+ addressstreet: string;
23
+ addressunit: string;
24
+ primarynumber: number;
25
+ streetname: string;
26
+ streetpredirection?: string | undefined;
27
+ streetpostdirection?: string | undefined;
28
+ streetsuffix: string;
29
+ secondarynumber?: number | undefined;
30
+ secondarydesignator: string;
31
+ extrasecondarynumber?: number | undefined;
32
+ extrasecondarydesignator?: string | undefined;
33
+ cityname: string;
34
+ stateabbreviation: string;
35
+ zipcode: string;
36
+ latitude: number;
37
+ longitude: number;
38
+ situsstatecode: string;
39
+ situscounty: string;
40
+ propertyjurisdictionname: string;
41
+ situsstatecountyfips: number;
42
+ combinedstatisticalarea: string;
43
+ cbsaname: string;
44
+ cbsacode: number;
45
+ msaname: string;
46
+ msacode: number;
47
+ metropolitandivision: string;
48
+ minorcivildivisionname: string;
49
+ minorcivildivisioncode: number;
50
+ neighborhoodcode: string;
51
+ censusfipsplacecode: number;
52
+ censustract: number;
53
+ censusblockgroup: number;
54
+ censusblock: number;
55
+ parcelnumberraw: string;
56
+ parcelnumberformatted: string;
57
+ parcelnumberyearadded: number;
58
+ parcelnumberalternate: string;
59
+ parcelmapbook: string;
60
+ parcelmappage: string;
61
+ parcelnumberyearchange: number;
62
+ parcelnumberprevious: string;
63
+ parcelaccountnumber: string;
64
+ propertyaddressfull: string;
65
+ propertyaddresshousenumber: number;
66
+ propertyaddressstreetdirection: string;
67
+ propertyaddressstreetname: string;
68
+ propertyaddressstreetsuffix: string;
69
+ propertyaddressstreetpostdirection: string;
70
+ propertyaddressunitprefix: string;
71
+ propertyaddressunitvalue: string;
72
+ propertyaddresscity: string;
73
+ propertyaddressstate: string;
74
+ propertyaddresszip: number;
75
+ propertyaddresszip4: number;
76
+ propertyaddresscrrt: string;
77
+ propertyaddressinfoprivacy: number;
78
+ congressionaldistricthouse: number;
79
+ legaldescription: string;
80
+ legalrange: string;
81
+ legaltownship: string;
82
+ legalsection: number;
83
+ legalquarter: string;
84
+ legalquarterquarter: string;
85
+ legalsubdivision: string;
86
+ legalphase: string;
87
+ legaltractnumber: number;
88
+ legalblock1: number;
89
+ legalblock2: string;
90
+ legallotnumber1: number;
91
+ legallotnumber2: string;
92
+ legallotnumber3: string;
93
+ legalunit: number;
94
+ partyowner1namefull: string;
95
+ partyowner1namefirst: string;
96
+ partyowner1namemiddle: string;
97
+ partyowner1namelast: string;
98
+ partyowner1namesuffix: string;
99
+ trustdescription: string;
100
+ companyflag: string;
101
+ partyowner2namefull: string;
102
+ partyowner2namefirst: string;
103
+ partyowner2namemiddle: string;
104
+ partyowner2namelast: string;
105
+ partyowner2namesuffix: string;
106
+ ownertypedescription1: string;
107
+ ownershipvestingrelationcode: string;
108
+ partyowner3namefull: string;
109
+ partyowner3namefirst: string;
110
+ partyowner3namemiddle: string;
111
+ partyowner3namelast: string;
112
+ partyowner3namesuffix: string;
113
+ partyowner4namefull: string;
114
+ partyowner4namefirst: string;
115
+ partyowner4namemiddle: string;
116
+ partyowner4namelast: string;
117
+ partyowner4namesuffix: string;
118
+ ownertypedescription2: string;
119
+ contactownermailingcounty: string;
120
+ contactownermailingfips: number;
121
+ contactownermailaddressfull: string;
122
+ contactownermailaddresshousenumber: number;
123
+ contactownermailaddressstreetdirection: string;
124
+ contactownermailaddressstreetname: string;
125
+ contactownermailaddressstreetsuffix: string;
126
+ contactownermailaddressstreetpostdirection: string;
127
+ contactownermailaddressunitprefix: string;
128
+ contactownermailaddressunit: string;
129
+ contactownermailaddresscity: string;
130
+ contactownermailaddressstate: string;
131
+ contactownermailaddresszip: number;
132
+ contactownermailaddresszip4: number;
133
+ contactownermailaddresscrrt: string;
134
+ contactownermailaddressinfoformat: string;
135
+ contactownermailinfoprivacy: string;
136
+ statusowneroccupiedflag: string;
137
+ deedowner1namefull: string;
138
+ deedowner1namefirst: string;
139
+ deedowner1namemiddle: string;
140
+ deedowner1namelast: string;
141
+ deedowner1namesuffix: string;
142
+ deedowner2namefull: string;
143
+ deedowner2namefirst: string;
144
+ deedowner2namemiddle: string;
145
+ deedowner2namelast: string;
146
+ deedowner2namesuffix: string;
147
+ deedowner3namefull: string;
148
+ deedowner3namefirst: string;
149
+ deedowner3namemiddle: string;
150
+ deedowner3namelast: string;
151
+ deedowner3namesuffix: string;
152
+ deedowner4namefull: string;
153
+ deedowner4namefirst: string;
154
+ deedowner4namemiddle: string;
155
+ deedowner4namelast: string;
156
+ deedowner4namesuffix: string;
157
+ taxyearassessed: number;
158
+ taxassessedvaluetotal: number;
159
+ taxassessedvalueimprovements: number;
160
+ taxassessedvalueland: number;
161
+ taxassessedimprovementsperc: number;
162
+ previousassessedvalue: number;
163
+ taxmarketvalueyear: number;
164
+ taxmarketvaluetotal: number;
165
+ taxmarketvalueimprovements: number;
166
+ taxmarketvalueland: number;
167
+ taxmarketimprovementsperc: number;
168
+ taxfiscalyear: number;
169
+ taxratearea: string;
170
+ taxbilledamount: number;
171
+ taxdelinquentyear: number;
172
+ lastassessortaxrollupdate: string;
173
+ assrlastupdated: string;
174
+ taxexemptionadditional: string;
175
+ yearbuilt: number;
176
+ yearbuilteffective: number;
177
+ zonedcodelocal: string;
178
+ propertyusemuni: string;
179
+ propertyusegroup: string;
180
+ propertyusestandardized: string;
181
+ assessorlastsaledate: Date;
182
+ assessorlastsaleamount: number;
183
+ assessorpriorsaledate: null;
184
+ assessorpriorsaleamount: number;
185
+ lastownershiptransferdate: string;
186
+ lastownershiptransferdocumentnumber: string;
187
+ lastownershiptransfertransactionid: number;
188
+ deedlastsaledocumentbook: string;
189
+ deedlastsaledocumentpage: string;
190
+ deedlastdocumentnumber: string;
191
+ deedlastsaledate: string;
192
+ deedlastsaleprice: number;
193
+ deedlastsaletransactionid: number;
194
+ areabuilding: number;
195
+ areabuildingdefinitioncode: string;
196
+ areagross: number;
197
+ area1stfloor: number;
198
+ area2ndfloor: number;
199
+ areaupperfloors: number;
200
+ arealotacres: number;
201
+ arealotsf: number;
202
+ arealotdepth: number;
203
+ arealotwidth: number;
204
+ roomsatticarea: number;
205
+ roomsatticflag: number;
206
+ roomsbasementarea: number;
207
+ roomsbasementareafinished: number;
208
+ roomsbasementareaunfinished: number;
209
+ parkinggarage: string;
210
+ parkinggaragearea: number;
211
+ parkingcarport: number;
212
+ parkingcarportarea: number;
213
+ hvaccoolingdetail: string;
214
+ hvacheatingdetail: string;
215
+ hvacheatingfuel: string;
216
+ utilitiessewageusage: string;
217
+ utilitieswatersource: string;
218
+ utilitiesmobilehomehookupflag: string;
219
+ foundation: string;
220
+ construction: string;
221
+ interiorstructure: string;
222
+ plumbingfixturescount: number;
223
+ constructionfireresistanceclass: string;
224
+ assafetyfiresprinklersflag: string;
225
+ flooringmaterialprimary: string;
226
+ bathcount: number;
227
+ bathpartialcount: number;
228
+ bedroomscount: number;
229
+ roomscount: number;
230
+ storiescount: number;
231
+ unitscount: number;
232
+ fireplace: string;
233
+ fireplacecount: number;
234
+ structurestyle: string;
235
+ exterior1code: string;
236
+ roofmaterial: string;
237
+ roofconstruction: string;
238
+ porchcode: string;
239
+ pool: string;
240
+ poolarea: number;
241
+ buildingscount: number;
242
+ modifiedon: string;
243
+ location: string;
244
+ _id: import("bson").ObjectID;
245
+ }[];
@@ -0,0 +1,13 @@
1
+ export interface ResultsMeta {
2
+ requests: number;
3
+ properties: number;
4
+ errors: number;
5
+ filters?: number;
6
+ }
7
+ declare type ProcessInput = [from: string, to: string] | string;
8
+ export declare function zipProcessor(workers: number, processorFn: (zip: string, errors: Set<string>) => Promise<ResultsMeta>): {
9
+ getProcessor: () => AsyncGenerator<ResultsMeta | ResultsMeta[], void, unknown> | null;
10
+ start: (zips: ProcessInput) => Promise<Required<ResultsMeta>>;
11
+ clear: () => Promise<void>;
12
+ };
13
+ export {};
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.zipProcessor = void 0;
5
5
  const utils_1 = require("./utils/utils");
6
- function zipProcessor(config, processorFn) {
6
+ function zipProcessor(workers, processorFn) {
7
7
  let processor = null;
8
8
  let erroredZips = new Set();
9
9
  async function* processZips(zips) {
@@ -18,7 +18,7 @@ function zipProcessor(config, processorFn) {
18
18
  }
19
19
  for (let zipNum = startZipNum; zipNum <= endZipNum;) {
20
20
  const processes = [];
21
- const processZipEnd = zipNum + config.workers - 1;
21
+ const processZipEnd = zipNum + workers - 1;
22
22
  for (; zipNum <= endZipNum && zipNum <= processZipEnd; zipNum++) {
23
23
  const zip = (0, utils_1.convertToZipString)(zipNum);
24
24
  processes.push(processorFn(zip, erroredZips));
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@servicetitan/acquisition-functions",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc -p .",
9
+ "build-test": "tsc -p tsconfig.test.json",
9
10
  "test": "jest --runInBand"
10
11
  },
11
12
  "files": [
@@ -13,7 +14,6 @@
13
14
  ],
14
15
  "devDependencies": {
15
16
  "@jest/globals": "29.1.2",
16
- "@tsconfig/node16": "^1.0.3",
17
17
  "@types/jest": "^29.1.0",
18
18
  "@types/mongodb": "^3.6.20",
19
19
  "@types/node": "^18.6.3",
@@ -28,5 +28,5 @@
28
28
  "cli": {
29
29
  "webpack": false
30
30
  },
31
- "gitHead": "b84931ee346bdbc12af2e5597b5fb7637fd45c25"
31
+ "gitHead": "722e4224af6b19d0a4a410bdcfa071557e2b3af7"
32
32
  }