@@ -189,6 +189,9 @@ def bulk_apply_activist_codes(self, tbl, url_type, **url_kwargs):
189
189
* - ``datecanvassed``
190
190
- No
191
191
- An ISO formatted date
192
+ * - ``canvassedby``
193
+ - No
194
+ - A valid User ID; Required when DateCanvassed is provided
192
195
* - ``contacttypeid``
193
196
- No
194
197
- The method of contact.
@@ -249,7 +252,7 @@ def bulk_upsert_contacts(self, tbl, url_type, result_fields=None, **url_kwargs):
249
252
-
250
253
-
251
254
* - First Name
252
- - ``fn``, ``firstname``, ``last ``
255
+ - ``fn``, ``firstname``, ``first ``
253
256
-
254
257
* - Middle Name
255
258
- ``mn``, ``middlename``, ``middle``
@@ -258,8 +261,8 @@ def bulk_upsert_contacts(self, tbl, url_type, result_fields=None, **url_kwargs):
258
261
- ``ln``, ``lastname``, ``last``
259
262
-
260
263
* - Date of Birth
261
- - ``dob``, ``dateofbirth`` ``birthdate``
262
- - What type of thing does this need?
264
+ - ``dob``, ``dateofbirth``, ``birthdate``
265
+ - An ISO formatted date
263
266
* - Sex
264
267
- ``sex``, ``gender``
265
268
-
@@ -281,6 +284,9 @@ def bulk_upsert_contacts(self, tbl, url_type, result_fields=None, **url_kwargs):
281
284
* - State Or Province
282
285
- ``state``, ``st``, ``stateorprovince``
283
286
-
287
+ * - Zip or Postal Code
288
+ - ``ziporpostal``, ``postal``, ``postalcode``, ``zip``, ``zipcode``
289
+ -
284
290
* - Country Code
285
291
- ``countrycode``, ``country``
286
292
- A valid two character country code (e.g. ``US``)
@@ -309,6 +315,9 @@ def bulk_upsert_contacts(self, tbl, url_type, result_fields=None, **url_kwargs):
309
315
* - Email
310
316
- ``email``, ``emailaddress``
311
317
-
318
+ * - Other Email
319
+ - ``otheremail``, ``email2``, ``emailaddress2``
320
+ -
312
321
313
322
`Args:`
314
323
table: Parsons table
@@ -325,7 +334,7 @@ def bulk_upsert_contacts(self, tbl, url_type, result_fields=None, **url_kwargs):
325
334
The bulk import job id
326
335
"""
327
336
328
- tbl = tbl .map_columns (COLUMN_MAP , exact_match = False )
337
+ tbl = tbl .map_columns (CONTACTS_COLUMN_MAP , exact_match = False )
329
338
330
339
return self .post_bulk_import (
331
340
tbl ,
@@ -339,13 +348,13 @@ def bulk_upsert_contacts(self, tbl, url_type, result_fields=None, **url_kwargs):
339
348
340
349
def bulk_apply_suppressions (self , tbl , url_type , ** url_kwargs ):
341
350
"""
342
- Bulk apply contact suppressions codes.
351
+ Bulk apply contact suppression codes.
343
352
344
353
The table may include the following columns. The first column
345
354
must be ``vanid``.
346
355
347
356
.. list-table::
348
- :widths: 25 25
357
+ :widths: 25 25 50
349
358
:header-rows: 1
350
359
351
360
* - Column Name
@@ -381,11 +390,140 @@ def bulk_apply_suppressions(self, tbl, url_type, **url_kwargs):
381
390
** url_kwargs ,
382
391
)
383
392
393
+ def bulk_apply_canvass_results (self , tbl , url_type , ** url_kwargs ):
394
+ """
395
+ Bulk apply contact canvass results.
396
+
397
+ The table may include the following columns. The first column
398
+ must be ``vanid``.
399
+
400
+ .. list-table::
401
+ :widths: 25 25 50
402
+ :header-rows: 1
403
+
404
+ * - Column Name
405
+ - Required
406
+ - Description
407
+ * - ``vanid``
408
+ - Yes
409
+ - A valid VANID primary key
410
+ * - ``contacttypeid``
411
+ - Yes
412
+ - Valid Contact Type ID
413
+ * - ``resultid``
414
+ - Yes
415
+ - Valid Contact Result ID
416
+ * - ``datecanvassed``
417
+ - Yes
418
+ - ISO Date Format
419
+ * - ``canvassedby``
420
+ - Yes
421
+ - Valid User ID
422
+ * - ``phone``
423
+ - No
424
+ - Attempted Phone Number
425
+ * - ``countrycode``
426
+ - No
427
+ - Country Code (ISO 3166-1 alpha-2)
428
+ * - ``phonetypeid``
429
+ - No
430
+ - Phone Type
431
+ * - ``phoneoptinstatusid``
432
+ - No
433
+ - SMS Opt-In Status
434
+ * - ``addressid``
435
+ - No
436
+ - The Contact Address ID of the address that was canvassed
437
+
438
+ `Args:`
439
+ table: Parsons table
440
+ A Parsons table.
441
+ url_type: str
442
+ The cloud file storage to use to post the file (``S3`` or ``GCS``).
443
+ See :ref:`Cloud Storage <cloud-storage>` for more details.
444
+ **url_kwargs: kwargs
445
+ Arguments to configure your cloud storage url type. See
446
+ :ref:`Cloud Storage <cloud-storage>` for more details.
447
+ `Returns:`
448
+ int
449
+ The bulk import job id
450
+ """
451
+
452
+ return self .post_bulk_import (
453
+ tbl ,
454
+ url_type ,
455
+ "Contacts" ,
456
+ [{"name" : "CanvassResults" }],
457
+ "Apply Canvass Results" ,
458
+ ** url_kwargs ,
459
+ )
460
+
461
+ def bulk_apply_contact_custom_fields (self , custom_field_group_id , tbl , url_type , ** url_kwargs ):
462
+ """
463
+ Bulk apply contact custom fields.
464
+
465
+ The table may include the following columns. The first column
466
+ must be ``vanid``.
467
+
468
+ .. list-table::
469
+ :widths: 25 25 60
470
+ :header-rows: 1
471
+
472
+ * - Column Name
473
+ - Required
474
+ - Description
475
+ * - ``vanid``
476
+ - Yes
477
+ - A valid VANID primary key
478
+ * - ***``CF{CustomFieldID}``
479
+ - Yes
480
+ - At least one custom field column to be loaded associated with the provided
481
+ custom_field_group_id. The column name should be a valid Custom Field ID
482
+ prefixed with ``CF``, i.e. CF123.
483
+
484
+ `Args:`
485
+ custom_field_group_id: int
486
+ Valid Custom Contact Field Group ID; must be the parent of
487
+ the provided Custom Field IDs in the file.
488
+ table: Parsons table
489
+ A Parsons table.
490
+ url_type: str
491
+ The cloud file storage to use to post the file (``S3`` or ``GCS``).
492
+ See :ref:`Cloud Storage <cloud-storage>` for more details.
493
+ **url_kwargs: kwargs
494
+ Arguments to configure your cloud storage url type. See
495
+ :ref:`Cloud Storage <cloud-storage>` for more details.
496
+ `Returns:`
497
+ int
498
+ The bulk import job id
499
+ """
500
+
501
+ mapping_types = [
502
+ {
503
+ "name" : "ApplyContactCustomFields" ,
504
+ "fieldValueMappings" : [
505
+ {
506
+ "fieldName" : "CustomFieldGroupID" ,
507
+ "staticValue" : custom_field_group_id ,
508
+ },
509
+ ],
510
+ }
511
+ ]
512
+
513
+ return self .post_bulk_import (
514
+ tbl ,
515
+ url_type ,
516
+ "Contacts" ,
517
+ mapping_types ,
518
+ "Apply Contact Custom Fields" ,
519
+ ** url_kwargs ,
520
+ )
521
+
384
522
385
523
# This is a column mapper that is used to accept additional column names and provide
386
524
# flexibility for the user.
387
525
388
- COLUMN_MAP = {
526
+ CONTACTS_COLUMN_MAP = {
389
527
"firstname" : ["fn" , "first" ],
390
528
"middlename" : ["mn" , "middle" ],
391
529
"lastname" : ["ln" , "last" ],
@@ -396,11 +534,13 @@ def bulk_apply_suppressions(self, tbl, url_type, **url_kwargs):
396
534
"addressline3" : ["addressline3" , "address3" ],
397
535
"city" : [],
398
536
"stateorprovince" : ["state" , "st" ],
537
+ "ziporpostal" : ["postal" , "postalcode" , "zip" , "zipcode" ],
399
538
"countrycode" : ["country" ],
400
539
"displayasentered" : [],
401
540
"cellphone" : ["cell" ],
402
541
"cellphonecountrycode" : ["cellcountrycode" ],
403
542
"phone" : ["home" , "homephone" ],
404
543
"phonecountrycode" : ["phonecountrycode" ],
405
544
"email" : ["emailaddress" ],
545
+ "otheremail" : ["email2" , "emailaddress2" ],
406
546
}
0 commit comments