contact-person-profile-csv-imp-local 0.0.22__py3-none-any.whl → 0.0.24__py3-none-any.whl
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.
- contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py +37 -52
- {contact_person_profile_csv_imp_local-0.0.22.dist-info → contact_person_profile_csv_imp_local-0.0.24.dist-info}/METADATA +1 -1
- {contact_person_profile_csv_imp_local-0.0.22.dist-info → contact_person_profile_csv_imp_local-0.0.24.dist-info}/RECORD +5 -5
- {contact_person_profile_csv_imp_local-0.0.22.dist-info → contact_person_profile_csv_imp_local-0.0.24.dist-info}/WHEEL +0 -0
- {contact_person_profile_csv_imp_local-0.0.22.dist-info → contact_person_profile_csv_imp_local-0.0.24.dist-info}/top_level.txt +0 -0
|
@@ -279,9 +279,10 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
279
279
|
contact_dict["data_source_instance_id"] = data_source_instance_id
|
|
280
280
|
contact_dict["source"] = "Import"
|
|
281
281
|
contact_id = self.contacts_local.upsert_contact_dict(contact_dict=contact_dict)
|
|
282
|
+
contact_dict["contact_id"] = contact_id
|
|
282
283
|
if contact_id:
|
|
283
284
|
self.__insert_contact_details_to_db(
|
|
284
|
-
|
|
285
|
+
contact_dict=contact_dict, user_external_id=user_external_id,
|
|
285
286
|
data_source_instance_id=data_source_instance_id,
|
|
286
287
|
data_source_type_id=data_source_type_id)
|
|
287
288
|
contact_data_by_contact_id_dict[contact_id] = contact_dict
|
|
@@ -340,33 +341,32 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
340
341
|
select_clause_value="location_type_id", column_name="title", column_value=location_type_name)
|
|
341
342
|
return location_type_id
|
|
342
343
|
|
|
343
|
-
def __insert_contact_details_to_db(self, *,
|
|
344
|
+
def __insert_contact_details_to_db(self, *, contact_dict: dict, user_external_id: int,
|
|
344
345
|
data_source_instance_id: int, data_source_type_id: int) -> int:
|
|
345
346
|
|
|
346
|
-
location_id = DEFAULT_LOCATION_ID
|
|
347
347
|
# insert organization
|
|
348
348
|
organization_id = self.__insert_organization(contact_dict=contact_dict)
|
|
349
349
|
|
|
350
350
|
# insert link contact_location
|
|
351
351
|
# The location is in contact_dict
|
|
352
352
|
location_results = self.__insert_link_contact_location(
|
|
353
|
-
contact_dict=contact_dict
|
|
354
|
-
location_id = location_results[0].get(
|
|
355
|
-
"location_id")
|
|
356
|
-
country_id = location_results[0].get("country_id")
|
|
353
|
+
contact_dict=contact_dict) or [{}]
|
|
354
|
+
contact_dict["location_id"] = location_results[0].get(
|
|
355
|
+
"location_id")
|
|
356
|
+
contact_dict["country_id"] = location_results[0].get("country_id")
|
|
357
357
|
|
|
358
358
|
# insert link contact_group
|
|
359
359
|
self.__insert_link_contact_groups(
|
|
360
|
-
contact_dict=contact_dict
|
|
360
|
+
contact_dict=contact_dict)
|
|
361
361
|
|
|
362
362
|
# insert link contact_persons
|
|
363
363
|
contact_person_result_dict = self.__insert_link_contact_persons(
|
|
364
|
-
contact_dict=contact_dict
|
|
365
|
-
person_id = contact_person_result_dict.get("person_id")
|
|
364
|
+
contact_dict=contact_dict) or {}
|
|
365
|
+
contact_dict["person_id"] = contact_person_result_dict.get("person_id")
|
|
366
366
|
|
|
367
367
|
# insert link contact_profiles
|
|
368
368
|
contact_profile_info = self.__insert_contact_profiles(
|
|
369
|
-
contact_dict=contact_dict
|
|
369
|
+
contact_dict=contact_dict) or {}
|
|
370
370
|
|
|
371
371
|
profile_id = contact_profile_info.get("profile_id")
|
|
372
372
|
|
|
@@ -376,27 +376,26 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
376
376
|
|
|
377
377
|
# insert link contact_email_addresses
|
|
378
378
|
self.__insert_link_contact_email_addresses(
|
|
379
|
-
contact_dict=contact_dict,
|
|
379
|
+
contact_dict=contact_dict, profile_id=profile_id)
|
|
380
380
|
|
|
381
381
|
# insert link contact_notes
|
|
382
|
-
|
|
383
|
-
contact_dict=contact_dict,
|
|
382
|
+
CSVToContactPersonProfile.__insert_link_contact_notes_and_text_blocks(
|
|
383
|
+
contact_dict=contact_dict, profile_id=profile_id)
|
|
384
384
|
|
|
385
385
|
# insert link contact_phones
|
|
386
386
|
self.__insert_link_contact_phones(
|
|
387
|
-
contact_dict=contact_dict,
|
|
388
|
-
person_id=person_id, location_id=location_id, country_id=country_id)
|
|
387
|
+
contact_dict=contact_dict, profile_id=profile_id)
|
|
389
388
|
|
|
390
389
|
# inset link contact_user_externals
|
|
391
390
|
self.__insert_link_contact_user_external(
|
|
392
|
-
contact_dict=contact_dict
|
|
391
|
+
contact_dict=contact_dict)
|
|
393
392
|
|
|
394
393
|
# insert link contact_internet_domains
|
|
395
394
|
self.__insert_link_contact_domains(
|
|
396
|
-
contact_dict=contact_dict
|
|
395
|
+
contact_dict=contact_dict)
|
|
397
396
|
|
|
398
397
|
importer_id = self.__insert_importer(
|
|
399
|
-
contact_id=contact_id, location_id=location_id,
|
|
398
|
+
contact_id=contact_dict.get("contact_id"), location_id=contact_dict.get("location_id") or DEFAULT_LOCATION_ID,
|
|
400
399
|
user_external_id=user_external_id,
|
|
401
400
|
data_source_instance_id=data_source_instance_id,
|
|
402
401
|
data_source_type_id=data_source_type_id
|
|
@@ -457,8 +456,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
457
456
|
|
|
458
457
|
return organization_profile_id
|
|
459
458
|
|
|
460
|
-
def __insert_link_contact_groups(self, contact_dict: dict
|
|
461
|
-
|
|
459
|
+
def __insert_link_contact_groups(self, contact_dict: dict) -> list:
|
|
460
|
+
contact_id = contact_dict.get("contact_id")
|
|
462
461
|
groups = []
|
|
463
462
|
groups_linked = None
|
|
464
463
|
if contact_dict.get("organization"):
|
|
@@ -471,7 +470,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
471
470
|
|
|
472
471
|
return groups_linked
|
|
473
472
|
|
|
474
|
-
def __insert_link_contact_persons(self, contact_dict: dict
|
|
473
|
+
def __insert_link_contact_persons(self, contact_dict: dict) -> dict:
|
|
475
474
|
if not contact_dict.get("first_name") and not contact_dict.get("last_name"):
|
|
476
475
|
return {}
|
|
477
476
|
phones_local = PhonesLocal(is_test_data=self.is_test_data)
|
|
@@ -486,14 +485,12 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
486
485
|
contact_person_results_dict = self.contact_persons.insert_contact_and_link_to_existing_or_new_person(
|
|
487
486
|
contact_dict=contact_dict,
|
|
488
487
|
contact_email_address=contact_dict["email1"],
|
|
489
|
-
contact_normalized_phone_number=contact_normalized_phone_number
|
|
490
|
-
contact_id=contact_id
|
|
488
|
+
contact_normalized_phone_number=contact_normalized_phone_number
|
|
491
489
|
)
|
|
492
490
|
|
|
493
491
|
return contact_person_results_dict
|
|
494
492
|
|
|
495
|
-
def __insert_link_contact_email_addresses(self, contact_dict: dict,
|
|
496
|
-
profile_id: int = None) -> list[int]:
|
|
493
|
+
def __insert_link_contact_email_addresses(self, contact_dict: dict, profile_id: int = None) -> list[int]:
|
|
497
494
|
email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
|
|
498
495
|
contact_dict=contact_dict)
|
|
499
496
|
contact_email_addresses = self.contact_email_addresses
|
|
@@ -502,8 +499,6 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
502
499
|
contact_email_address_id = contact_email_addresses.insert_contact_and_link_to_email_address(
|
|
503
500
|
contact_dict=contact_dict,
|
|
504
501
|
contact_email_address_str=email_address,
|
|
505
|
-
contact_id=contact_id,
|
|
506
|
-
person_id=person_id,
|
|
507
502
|
profile_id=profile_id
|
|
508
503
|
)
|
|
509
504
|
contact_email_address_ids.append(contact_email_address_id)
|
|
@@ -512,7 +507,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
512
507
|
|
|
513
508
|
@staticmethod
|
|
514
509
|
def __insert_link_contact_notes_and_text_blocks(
|
|
515
|
-
*, contact_dict: dict,
|
|
510
|
+
*, contact_dict: dict, profile_id: int) -> int or None:
|
|
516
511
|
if not contact_dict.get("notes"):
|
|
517
512
|
return
|
|
518
513
|
# TODO: I think we should change ContactNotesLocal - send the args to the method and not the class
|
|
@@ -520,34 +515,27 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
520
515
|
# TODO: check if this method works with profile_id = None
|
|
521
516
|
profile_id = DEFAULT_PROFILE_ID
|
|
522
517
|
contact_notes = ContactNotesLocal(
|
|
523
|
-
contact_dict=contact_dict,
|
|
518
|
+
contact_dict=contact_dict, profile_id=profile_id)
|
|
524
519
|
insert_information = contact_notes.insert_contact_notes_text_block() or {}
|
|
525
520
|
contact_note_id = insert_information.get("contact_note_id")
|
|
526
521
|
return contact_note_id
|
|
527
522
|
|
|
528
|
-
def __insert_link_contact_phones(self, contact_dict: dict,
|
|
529
|
-
location_id: int, country_id: int) -> list[int]:
|
|
530
|
-
if location_id == DEFAULT_LOCATION_ID:
|
|
531
|
-
location_id = None
|
|
523
|
+
def __insert_link_contact_phones(self, contact_dict: dict, profile_id: int) -> list[int]:
|
|
532
524
|
phone_numbers = self.contacts_local.get_contact_phone_numbers_from_contact_dict(
|
|
533
525
|
contact_dict=contact_dict)
|
|
534
526
|
contact_phone_ids = []
|
|
535
|
-
for
|
|
527
|
+
for phone_number_original in phone_numbers:
|
|
536
528
|
process_phone_result_dict = self.contact_phone.insert_contact_and_link_to_existing_or_new_phone(
|
|
537
529
|
contact_dict=contact_dict,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
profile_id=profile_id,
|
|
541
|
-
person_id=person_id,
|
|
542
|
-
location_id=location_id,
|
|
543
|
-
country_id=country_id
|
|
530
|
+
phone_number_original=phone_number_original,
|
|
531
|
+
profile_id=profile_id
|
|
544
532
|
)
|
|
545
533
|
contact_phone_ids.append(process_phone_result_dict.get("contact_phone_id"))
|
|
546
534
|
|
|
547
535
|
return contact_phone_ids
|
|
548
536
|
|
|
549
|
-
def __insert_link_contact_user_external(self, contact_dict: dict
|
|
550
|
-
|
|
537
|
+
def __insert_link_contact_user_external(self, contact_dict: dict) -> int:
|
|
538
|
+
contact_id = contact_dict.get("contact_id")
|
|
551
539
|
contact_user_external_id = self.contact_user_external.insert_contact_and_link_to_existing_or_new_user_external(
|
|
552
540
|
contact_dict=contact_dict,
|
|
553
541
|
contact_email_address=contact_dict["email1"],
|
|
@@ -557,18 +545,15 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
557
545
|
|
|
558
546
|
return contact_user_external_id
|
|
559
547
|
|
|
560
|
-
def __insert_contact_profiles(self, contact_dict: dict
|
|
561
|
-
|
|
548
|
+
def __insert_contact_profiles(self, contact_dict: dict) -> dict:
|
|
562
549
|
insert_information = self.contact_profiles.insert_and_link_contact_profile(
|
|
563
|
-
contact_dict=contact_dict
|
|
564
|
-
contact_id=contact_id,
|
|
565
|
-
person_id=person_id
|
|
550
|
+
contact_dict=contact_dict
|
|
566
551
|
)
|
|
567
552
|
|
|
568
553
|
return insert_information
|
|
569
554
|
|
|
570
|
-
def __insert_link_contact_domains(self, contact_dict: dict
|
|
571
|
-
|
|
555
|
+
def __insert_link_contact_domains(self, contact_dict: dict) -> list[dict]:
|
|
556
|
+
contact_id = contact_dict.get("contact_id")
|
|
572
557
|
website_count = 1
|
|
573
558
|
website_url = contact_dict.get("website" + str(website_count))
|
|
574
559
|
domain_insert_information_list = []
|
|
@@ -581,8 +566,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
581
566
|
|
|
582
567
|
return domain_insert_information_list
|
|
583
568
|
|
|
584
|
-
def __insert_link_contact_location(self, contact_dict: dict
|
|
585
|
-
|
|
569
|
+
def __insert_link_contact_location(self, contact_dict: dict) -> list[dict] or None:
|
|
570
|
+
contact_id = contact_dict.get("contact_id")
|
|
586
571
|
location_dicts = self.__procces_location_of_contact(contact_dict)
|
|
587
572
|
if not location_dicts:
|
|
588
573
|
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.24
|
|
4
4
|
Summary: PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python
|
|
5
5
|
Home-page: https://github.com/circles-zone/contact-person-profile-csv-imp-local-python-package
|
|
6
6
|
Author: Circles
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=
|
|
1
|
+
contact_person_profile_csv_imp_local/CSVToContactPersonProfile.py,sha256=9SlwE-jfTtxVZ62yIJbf6G85uVFhl1DxTUapbS54ctw,40564
|
|
2
2
|
contact_person_profile_csv_imp_local/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
contact_person_profile_csv_imp_local/contact_person_profile_csv_imp_local_constants.py,sha256=eE0Bg2dCPrmG72K20k0_KOckc61C9cGSgH0Zgae_lbk,957
|
|
4
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
5
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
6
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
7
|
-
contact_person_profile_csv_imp_local-0.0.
|
|
4
|
+
contact_person_profile_csv_imp_local-0.0.24.dist-info/METADATA,sha256=nbT0_trufQwvlavWU-xdeYtg6iAcV5njRen9Lk6s-fQ,1450
|
|
5
|
+
contact_person_profile_csv_imp_local-0.0.24.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
6
|
+
contact_person_profile_csv_imp_local-0.0.24.dist-info/top_level.txt,sha256=at6BnVzULDB109KZx9Cl9ClCHU4c0ykfV38WX-QR71U,37
|
|
7
|
+
contact_person_profile_csv_imp_local-0.0.24.dist-info/RECORD,,
|
|
File without changes
|