contact-person-profile-csv-imp-local 0.0.51__tar.gz → 0.0.55__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.
Files changed (13) hide show
  1. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/PKG-INFO +1 -1
  2. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local/src/CSVToContactPersonProfile.py +73 -5
  3. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/PKG-INFO +1 -1
  4. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/setup.py +1 -1
  5. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/README.md +0 -0
  6. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local/src/__init__.py +0 -0
  7. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local/src/contact_person_profile_csv_imp_local_constants.py +0 -0
  8. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/SOURCES.txt +0 -0
  9. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/dependency_links.txt +0 -0
  10. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/requires.txt +0 -0
  11. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/top_level.txt +0 -0
  12. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/pyproject.toml +0 -0
  13. {contact_person_profile_csv_imp_local-0.0.51 → contact_person_profile_csv_imp_local-0.0.55}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contact-person-profile-csv-imp-local
3
- Version: 0.0.51
3
+ Version: 0.0.55
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
@@ -6,7 +6,7 @@ import sys
6
6
  from zoneinfo import ZoneInfo
7
7
  import chardet
8
8
 
9
- from .contact_person_profile_csv_imp_local_constants import CSVToContactPersonProfileConstants
9
+ from src.contact_person_profile_csv_imp_local_constants import CSVToContactPersonProfileConstants
10
10
  from data_source_local.data_source import DataSources
11
11
  # from user_external_local.user_externals_local import UserExternalsLocal
12
12
  # from user_context_remote.user_context import UserContext
@@ -124,7 +124,9 @@ class CSVToContactPersonProfile(
124
124
  'contact_location', 'user_externals_local',
125
125
  'organizations_local', 'domain_local',
126
126
  'importers_local']
127
+ # TODO Can we remove the GenericCRUD inheritance and create self.profile_local
127
128
  GenericCRUD.__init__(self, default_schema_name="profile",
129
+ # TODO Can we remove the bellow line and make sure this is the default of database-mysql-local-python GenricCrud
128
130
  default_view_table_name="profile_view",
129
131
  is_test_data=is_test_data)
130
132
  self.contact_entity_type_id = \
@@ -207,6 +209,7 @@ class CSVToContactPersonProfile(
207
209
  # There can be multiple profiles with the same email, why not to query `user_external_table`.`main_profile_id`?
208
210
  # Answer: first, We can't query tables with GenericCRUD, second, we may not find profile_id in user_external table
209
211
  # and may have to insert a new record to user_external_table, in this case we need profile_id from profile_view
212
+ # TODO profile_local.select_one_value_by_column_and_value(
210
213
  profile_id = self.select_one_value_by_column_and_value(
211
214
  schema_name="user_external", view_table_name="user_external_view",
212
215
  select_clause_value="main_profile_id", column_name="username",
@@ -677,34 +680,48 @@ class CSVToContactPersonProfile(
677
680
  def __insert_link_contact_domains(self, contact_dict: dict) -> list[dict]:
678
681
  contact_id = contact_dict.get("contact_id")
679
682
  profiles_ids_list = contact_dict.get("profiles_ids_list")
683
+ organization_name = contact_dict.get("organization")
684
+ if organization_name:
685
+ organization_id = self.select_one_value_by_column_and_value(
686
+ schema_name="organization",
687
+ view_table_name="organization_view",
688
+ select_clause_value="organization_id",
689
+ column_name="name",
690
+ column_value=organization_name)
691
+ else:
692
+ organization_id = None
693
+
680
694
  website_count = 1
681
695
  website_url = contact_dict.get("website" + str(website_count))
682
696
  url_insert_information_list = []
683
697
  while website_url:
684
698
  if DomainLocal.is_domain(website_url):
685
699
  domain_insert_information_dict = self.domain_local.link_contact_to_domain(
686
- contact_id=contact_id, url=website_url)
700
+ contact_id=contact_id, url=website_url, organization_id=organization_id)
687
701
  url_insert_information_list.append(domain_insert_information_dict)
688
702
  elif DomainLocal.is_url(website_url):
689
703
  url_insert_information_dict = self.domain_local.link_contact_to_url(
690
704
  contact_id=contact_id, url=website_url, profiles_ids=profiles_ids_list)
691
705
  url_insert_information_list.append(url_insert_information_dict)
706
+ domain_insert_information_dict = self.domain_local.link_contact_to_domain(
707
+ contact_id=contact_id, url=website_url, organization_id=organization_id)
708
+ url_insert_information_list.append(domain_insert_information_dict)
692
709
  else:
693
- self.logger.warining(f"__insert_link_contact_domains: website_url: {website_url} is not a valid domain or url")
710
+ self.logger.warining(f"insert_link_contact_domains: website_url: {website_url} is not a valid domain or url")
694
711
  website_count += 1
695
712
  website_url = contact_dict.get("website" + str(website_count))
696
713
  url = contact_dict.get("url")
697
714
  if url:
698
715
  if DomainLocal.is_domain(url):
699
716
  domain_insert_information_dict = self.domain_local.link_contact_to_domain(
700
- contact_id=contact_id, url=url)
717
+ contact_id=contact_id, url=url, organization_id=organization_id)
701
718
  url_insert_information_list.append(domain_insert_information_dict)
702
719
  elif DomainLocal.is_url(url):
703
720
  url_insert_information_dict = self.domain_local.link_contact_to_url(
704
721
  contact_id=contact_id, url=url, profiles_ids=profiles_ids_list)
705
722
  url_insert_information_list.append(url_insert_information_dict)
706
723
  else:
707
- self.logger.warining(f"__insert_link_contact_domains: url: {url} is not a valid domain or url")
724
+ self.logger.warining(f"insert_link_contact_domains: url: {url} is not a valid domain or url")
708
725
 
709
726
  return url_insert_information_list
710
727
 
@@ -965,3 +982,54 @@ class CSVToContactPersonProfile(
965
982
  cellphone_number = '+972 ' + cellphone_number
966
983
  contact_dict['phone1'] = cellphone_number
967
984
  return contact_dict
985
+
986
+ def process_email_address(self, email_address: str) -> dict:
987
+ """
988
+ Process email address and extract domain information
989
+ :param email_address: Email adress to process
990
+ :return: Dict with email_address_id, internet_domain_name, internet_domain_name_id, organization_name, organization_id
991
+ """
992
+ # Example email address could be: circles@circlez.ai
993
+ if '@' not in email_address:
994
+ return None #Invalid email address
995
+
996
+ # Get domain name
997
+ internet_domain_name = email_address.split('@')[1]
998
+
999
+ # Get internet_domain_name_id based on internet_domain_name
1000
+ internet_domain_name_id = self.select_one_value_by_column_and_value(
1001
+ schema_name="internet_domain",
1002
+ view_table_name="internet_domain_view",
1003
+ select_clause_value="internet_domain_id",
1004
+ column_name="domain",
1005
+ column_value=internet_domain_name)
1006
+
1007
+ # Get organization_id name based on internet_domain_name
1008
+ organization_id = self.select_one_value_by_column_and_value(
1009
+ schema_name="internet_domain",
1010
+ view_table_name="internet_domain_view",
1011
+ select_clause_value="organization_id",
1012
+ column_name="domain",
1013
+ column_value=internet_domain_name)
1014
+
1015
+ # Get organization_name based on organization_id
1016
+ organization_name = self.select_one_value_by_column_and_value(
1017
+ schema_name="organization",
1018
+ view_table_name="organization_view",
1019
+ select_clause_value="name",
1020
+ column_name="organization_id",
1021
+ column_value=organization_id)
1022
+
1023
+ # Get email_address_id based on email_address
1024
+ email_address_id = self.select_one_value_by_column_and_value(
1025
+ schema_name="email_address",
1026
+ view_table_name="email_address_view",
1027
+ select_clause_value="email_address_id",
1028
+ column_name="email_address",
1029
+ column_value=email_address)
1030
+
1031
+ return {"email_address_id": email_address_id,
1032
+ "internet_domain_name": internet_domain_name,
1033
+ "internet_domain_name_id": internet_domain_name_id,
1034
+ "organization_name": organization_name,
1035
+ "organization_id": organization_id}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: contact-person-profile-csv-imp-local
3
- Version: 0.0.51
3
+ Version: 0.0.55
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
@@ -5,7 +5,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
5
5
 
6
6
  setuptools.setup(
7
7
  name=PACKAGE_NAME,
8
- version='0.0.51', # https://pypi.org/project/contact-person-profile-csv-imp-local/
8
+ version='0.0.55', # https://pypi.org/project/contact-person-profile-csv-imp-local/
9
9
 
10
10
  author="Circles",
11
11
  author_email="info@circles.ai",