contact-person-profile-csv-imp-local 0.0.20__tar.gz → 0.0.22__tar.gz
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-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/PKG-INFO +1 -1
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local/src/CSVToContactPersonProfile.py +40 -22
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local.egg-info/PKG-INFO +1 -1
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/setup.py +1 -1
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/README.md +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local/src/__init__.py +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local/src/contact_person_profile_csv_imp_local_constants.py +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local.egg-info/SOURCES.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local.egg-info/dependency_links.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local.egg-info/requires.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/contact_person_profile_csv_imp_local.egg-info/top_level.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/pyproject.toml +0 -0
- {contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/setup.cfg +0 -0
{contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/PKG-INFO
RENAMED
|
@@ -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.22
|
|
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
|
|
@@ -19,6 +19,7 @@ from database_mysql_local.generic_crud import GenericCRUD
|
|
|
19
19
|
from contact_user_external_local.contact_user_external_local import ContactUserExternalLocal
|
|
20
20
|
from contact_profile_local.contact_profiles_local import ContactProfilesLocal
|
|
21
21
|
from contact_phone_local.contact_phone_local import ContactPhoneLocal
|
|
22
|
+
from phones_local.phones_local import PhonesLocal
|
|
22
23
|
from contact_persons_local.contact_persons_local import ContactPersonsLocal
|
|
23
24
|
from contact_notes_local.contact_notes_local import ContactNotesLocal
|
|
24
25
|
from contact_location_local.contact_location_local import ContactLocationLocal
|
|
@@ -341,6 +342,8 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
341
342
|
|
|
342
343
|
def __insert_contact_details_to_db(self, *, contact_id: int, contact_dict: dict, user_external_id: int,
|
|
343
344
|
data_source_instance_id: int, data_source_type_id: int) -> int:
|
|
345
|
+
|
|
346
|
+
location_id = DEFAULT_LOCATION_ID
|
|
344
347
|
# insert organization
|
|
345
348
|
organization_id = self.__insert_organization(contact_dict=contact_dict)
|
|
346
349
|
|
|
@@ -363,9 +366,9 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
363
366
|
|
|
364
367
|
# insert link contact_profiles
|
|
365
368
|
contact_profile_info = self.__insert_contact_profiles(
|
|
366
|
-
contact_dict=contact_dict, contact_id=contact_id) or {}
|
|
369
|
+
contact_dict=contact_dict, contact_id=contact_id, person_id=person_id) or {}
|
|
367
370
|
|
|
368
|
-
profile_id = contact_profile_info.get("profile_id")
|
|
371
|
+
profile_id = contact_profile_info.get("profile_id")
|
|
369
372
|
|
|
370
373
|
# insert organization-profile
|
|
371
374
|
self.__insert_organization_profile(
|
|
@@ -373,7 +376,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
373
376
|
|
|
374
377
|
# insert link contact_email_addresses
|
|
375
378
|
self.__insert_link_contact_email_addresses(
|
|
376
|
-
contact_dict=contact_dict, contact_id=contact_id)
|
|
379
|
+
contact_dict=contact_dict, contact_id=contact_id, person_id=person_id, profile_id=profile_id)
|
|
377
380
|
|
|
378
381
|
# insert link contact_notes
|
|
379
382
|
self.__insert_link_contact_notes_and_text_blocks(
|
|
@@ -395,7 +398,6 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
395
398
|
importer_id = self.__insert_importer(
|
|
396
399
|
contact_id=contact_id, location_id=location_id,
|
|
397
400
|
user_external_id=user_external_id,
|
|
398
|
-
google_people_api_resource_name=contact_dict.get("resource_name"),
|
|
399
401
|
data_source_instance_id=data_source_instance_id,
|
|
400
402
|
data_source_type_id=data_source_type_id
|
|
401
403
|
)
|
|
@@ -448,7 +450,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
448
450
|
def __insert_organization_profile(self, organization_id: int, profile_id: int) -> int or None:
|
|
449
451
|
|
|
450
452
|
if not organization_id or not profile_id:
|
|
451
|
-
return
|
|
453
|
+
return None
|
|
452
454
|
|
|
453
455
|
organization_profile_id = self.organization_profiles.insert_mapping_if_not_exists(
|
|
454
456
|
organization_id=organization_id, profile_id=profile_id)
|
|
@@ -470,19 +472,28 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
470
472
|
return groups_linked
|
|
471
473
|
|
|
472
474
|
def __insert_link_contact_persons(self, contact_dict: dict, contact_id: int) -> dict:
|
|
475
|
+
if not contact_dict.get("first_name") and not contact_dict.get("last_name"):
|
|
476
|
+
return {}
|
|
477
|
+
phones_local = PhonesLocal(is_test_data=self.is_test_data)
|
|
478
|
+
contact_phone_number = contact_dict.get("phone1")
|
|
479
|
+
if contact_phone_number:
|
|
480
|
+
result_dict = phones_local.normalize_phone_number(
|
|
481
|
+
original_number=contact_phone_number, region=None)
|
|
482
|
+
if result_dict:
|
|
483
|
+
contact_normalized_phone_number = result_dict.get("full_number_normalized")
|
|
484
|
+
else:
|
|
485
|
+
contact_normalized_phone_number = None
|
|
473
486
|
contact_person_results_dict = self.contact_persons.insert_contact_and_link_to_existing_or_new_person(
|
|
474
487
|
contact_dict=contact_dict,
|
|
475
488
|
contact_email_address=contact_dict["email1"],
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
# TODO: what about phone2 etc?
|
|
489
|
+
contact_normalized_phone_number=contact_normalized_phone_number,
|
|
490
|
+
contact_id=contact_id
|
|
479
491
|
)
|
|
480
|
-
# contact_person_id = contact_person_results_dict.get("contact_person_id")
|
|
481
492
|
|
|
482
493
|
return contact_person_results_dict
|
|
483
494
|
|
|
484
|
-
def __insert_link_contact_email_addresses(self, contact_dict, contact_id
|
|
485
|
-
|
|
495
|
+
def __insert_link_contact_email_addresses(self, contact_dict: dict, contact_id: int, person_id: int = None,
|
|
496
|
+
profile_id: int = None) -> list[int]:
|
|
486
497
|
email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
|
|
487
498
|
contact_dict=contact_dict)
|
|
488
499
|
contact_email_addresses = self.contact_email_addresses
|
|
@@ -491,7 +502,9 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
491
502
|
contact_email_address_id = contact_email_addresses.insert_contact_and_link_to_email_address(
|
|
492
503
|
contact_dict=contact_dict,
|
|
493
504
|
contact_email_address_str=email_address,
|
|
494
|
-
contact_id=contact_id
|
|
505
|
+
contact_id=contact_id,
|
|
506
|
+
person_id=person_id,
|
|
507
|
+
profile_id=profile_id
|
|
495
508
|
)
|
|
496
509
|
contact_email_address_ids.append(contact_email_address_id)
|
|
497
510
|
|
|
@@ -503,20 +516,24 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
503
516
|
if not contact_dict.get("notes"):
|
|
504
517
|
return
|
|
505
518
|
# TODO: I think we should change ContactNotesLocal - send the args to the method and not the class
|
|
519
|
+
if profile_id is None:
|
|
520
|
+
# TODO: check if this method works with profile_id = None
|
|
521
|
+
profile_id = DEFAULT_PROFILE_ID
|
|
506
522
|
contact_notes = ContactNotesLocal(
|
|
507
523
|
contact_dict=contact_dict, contact_id=contact_id, profile_id=profile_id)
|
|
508
|
-
insert_information = contact_notes.insert_contact_notes_text_block()
|
|
524
|
+
insert_information = contact_notes.insert_contact_notes_text_block() or {}
|
|
509
525
|
contact_note_id = insert_information.get("contact_note_id")
|
|
510
526
|
return contact_note_id
|
|
511
527
|
|
|
512
528
|
def __insert_link_contact_phones(self, contact_dict: dict, contact_id: int, profile_id: int, person_id: int,
|
|
513
529
|
location_id: int, country_id: int) -> list[int]:
|
|
514
|
-
|
|
530
|
+
if location_id == DEFAULT_LOCATION_ID:
|
|
531
|
+
location_id = None
|
|
515
532
|
phone_numbers = self.contacts_local.get_contact_phone_numbers_from_contact_dict(
|
|
516
533
|
contact_dict=contact_dict)
|
|
517
534
|
contact_phone_ids = []
|
|
518
535
|
for phone_number in phone_numbers:
|
|
519
|
-
|
|
536
|
+
process_phone_result_dict = self.contact_phone.insert_contact_and_link_to_existing_or_new_phone(
|
|
520
537
|
contact_dict=contact_dict,
|
|
521
538
|
phone_number=phone_number,
|
|
522
539
|
contact_id=contact_id,
|
|
@@ -525,7 +542,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
525
542
|
location_id=location_id,
|
|
526
543
|
country_id=country_id
|
|
527
544
|
)
|
|
528
|
-
contact_phone_ids.append(
|
|
545
|
+
contact_phone_ids.append(process_phone_result_dict.get("contact_phone_id"))
|
|
529
546
|
|
|
530
547
|
return contact_phone_ids
|
|
531
548
|
|
|
@@ -540,10 +557,13 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
540
557
|
|
|
541
558
|
return contact_user_external_id
|
|
542
559
|
|
|
543
|
-
def __insert_contact_profiles(self, contact_dict: dict, contact_id: int) -> dict:
|
|
560
|
+
def __insert_contact_profiles(self, contact_dict: dict, contact_id: int, person_id: int = None) -> dict:
|
|
544
561
|
|
|
545
562
|
insert_information = self.contact_profiles.insert_and_link_contact_profile(
|
|
546
|
-
contact_dict=contact_dict,
|
|
563
|
+
contact_dict=contact_dict,
|
|
564
|
+
contact_id=contact_id,
|
|
565
|
+
person_id=person_id
|
|
566
|
+
)
|
|
547
567
|
|
|
548
568
|
return insert_information
|
|
549
569
|
|
|
@@ -573,8 +593,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
573
593
|
return location_results
|
|
574
594
|
|
|
575
595
|
def __insert_importer(self, contact_id: int, location_id: int, user_external_id: int,
|
|
576
|
-
|
|
577
|
-
data_source_instance_id: int) -> int:
|
|
596
|
+
data_source_type_id: int, data_source_instance_id: int) -> int:
|
|
578
597
|
# TODO: Shall we consider the url of csv's as the following? Use Sql2Code. Use const enum
|
|
579
598
|
if data_source_type_id == 16:
|
|
580
599
|
url = "www.google.com"
|
|
@@ -591,7 +610,6 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
591
610
|
entity_type_id=self.contact_entity_type_id,
|
|
592
611
|
entity_id=contact_id, url=url,
|
|
593
612
|
user_external_id=user_external_id,
|
|
594
|
-
google_people_api_resource_name=google_people_api_resource_name
|
|
595
613
|
)
|
|
596
614
|
|
|
597
615
|
return importer_id
|
|
@@ -738,7 +756,7 @@ class CSVToContactPersonProfile(GenericCRUD, metaclass=MetaLogger,
|
|
|
738
756
|
file_name: str,
|
|
739
757
|
user_external_username: str, start_index: int, end_index: int) -> int:
|
|
740
758
|
name = datetime.now(ZoneInfo("UTC")).strftime("%y%m%d %H%M%S") + " " + \
|
|
741
|
-
|
|
759
|
+
user_external_username + " 'Google Contact- Google Contact CSV'"
|
|
742
760
|
# TODO: move to data_source
|
|
743
761
|
data_source_instance_id = super().insert(
|
|
744
762
|
schema_name="data_source_instance",
|
|
@@ -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.22
|
|
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
|
{contact_person_profile_csv_imp_local-0.0.20 → contact_person_profile_csv_imp_local-0.0.22}/setup.py
RENAMED
|
@@ -5,7 +5,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name=PACKAGE_NAME,
|
|
8
|
-
version='0.0.
|
|
8
|
+
version='0.0.22', # https://pypi.org/project/contact-person-profile-csv-imp-local/
|
|
9
9
|
author="Circles",
|
|
10
10
|
author_email="info@circles.ai",
|
|
11
11
|
description="PyPI Package for Circles CSVToContactPersonProfile-local Local/Remote Python",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|