contact-person-profile-csv-imp-local 0.0.49__tar.gz → 0.0.51__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.49 → contact_person_profile_csv_imp_local-0.0.51}/PKG-INFO +1 -1
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local/src/CSVToContactPersonProfile.py +22 -63
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local/src/contact_person_profile_csv_imp_local_constants.py +1 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local.egg-info/PKG-INFO +1 -1
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/setup.py +1 -1
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/README.md +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local/src/__init__.py +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local.egg-info/SOURCES.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local.egg-info/dependency_links.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local.egg-info/requires.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/contact_person_profile_csv_imp_local.egg-info/top_level.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/pyproject.toml +0 -0
- {contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/setup.cfg +0 -0
{contact_person_profile_csv_imp_local-0.0.49 → contact_person_profile_csv_imp_local-0.0.51}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.51
|
|
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
|
|
@@ -51,12 +51,12 @@ DEFAULT_PROFILE_ID = 0
|
|
|
51
51
|
# Those methods should be called from the common method for this repo (contact-person-profile-csv-imp-local-python-package and google-contact-sync ...)
|
|
52
52
|
|
|
53
53
|
# TODO def process_first_name( original_first_name: str) -> str: (move to people-local-python-package)
|
|
54
|
-
#
|
|
55
|
-
# GroupsLocal.add_update_group_and_link_to_contact(
|
|
56
|
-
# return
|
|
54
|
+
# normalized_first_name = the first word in original_first_name
|
|
55
|
+
# GroupsLocal.add_update_group_and_link_to_contact( normalized_first_name, is_group=true, contact_id) # When checking if exists, ignore the upper-case lower-case
|
|
56
|
+
# return normalized_first_name
|
|
57
57
|
|
|
58
58
|
# TODO def process_last_name( original_last_name : str) -> str: (move to people-local-python-package)
|
|
59
|
-
#
|
|
59
|
+
# normalized_last_name = Remove all the digits from the last name
|
|
60
60
|
# GroupsLocal.add_update_group_and_link_to_contact( normilized_last_name, is_group=true, contact_id) # When checking if exists, ignore the upper-case lower-case
|
|
61
61
|
|
|
62
62
|
# TODO def process_phone( original_phone_number: str) -> str: (move to phone-local-python-package)
|
|
@@ -75,7 +75,7 @@ DEFAULT_PROFILE_ID = 0
|
|
|
75
75
|
# normalized_organization_name = GroupsLocal.add_update_group_and_link_to_contact( organization_name, is_organization=true) # When checking if the organization exists, remove suffix such as Ltd, Inc, בעמ... when searching ignore the uppper-case lower-case
|
|
76
76
|
|
|
77
77
|
# TODO def process_department( department_name: str) -> str: (move to people-local-python-package
|
|
78
|
-
# normalized_department_name = GroupsLocal.add_update_group_and_link_to_contact( department_name, is_department=true) # When searching ignore the upper-case lower-case, return the value with is_main == true
|
|
78
|
+
# normalized_department_name = GroupsLocal.add_update_group_and_link_to_contact( department_name, is_department=true) # When searching, ignore the upper-case lower-case, return the value with is_main == true
|
|
79
79
|
|
|
80
80
|
# TODO def process_continent( continent_name: str) -> str: (move to location-local-python-package)
|
|
81
81
|
# continent_id, normalized_continent_name = GroupsLocal.add_update_group_and_link_to_contact( continent_name, is_continent=true) # When checking if exists, ignore the upper-case lower-case, return the value with is_main == true
|
|
@@ -124,10 +124,8 @@ class CSVToContactPersonProfile(
|
|
|
124
124
|
'contact_location', 'user_externals_local',
|
|
125
125
|
'organizations_local', 'domain_local',
|
|
126
126
|
'importers_local']
|
|
127
|
-
GenericCRUD.__init__(self, default_schema_name="
|
|
128
|
-
|
|
129
|
-
default_table_name="field_table",
|
|
130
|
-
default_view_table_name="field_view",
|
|
127
|
+
GenericCRUD.__init__(self, default_schema_name="profile",
|
|
128
|
+
default_view_table_name="profile_view",
|
|
131
129
|
is_test_data=is_test_data)
|
|
132
130
|
self.contact_entity_type_id = \
|
|
133
131
|
self.select_one_value_by_column_and_value(
|
|
@@ -173,32 +171,11 @@ class CSVToContactPersonProfile(
|
|
|
173
171
|
# Otherwise, return the value
|
|
174
172
|
return value
|
|
175
173
|
|
|
176
|
-
|
|
177
|
-
#
|
|
178
|
-
# """
|
|
179
|
-
# Get the field name from the database
|
|
180
|
-
# :param field_id: The field ID
|
|
181
|
-
# :param data_source_type_id: The data source ID
|
|
182
|
-
# :return: The field name
|
|
183
|
-
# """
|
|
184
|
-
#
|
|
185
|
-
# 'data_source_type_id': data_source_type_id})
|
|
186
|
-
|
|
187
|
-
# self.set_schema(schema_name="data_source_field")
|
|
188
|
-
# data_source_field_tuples = self.select_multi_tuple_by_where(view_table_name="data_source_field_view",
|
|
189
|
-
# select_clause_value="external_field_name",
|
|
190
|
-
# where="data_source_type_id = %s AND field_id = %s",
|
|
191
|
-
# params=(data_source_type_id, field_id))
|
|
192
|
-
|
|
193
|
-
# if data_source_field_tuples:
|
|
194
|
-
#
|
|
195
|
-
# return data_source_field_tuples[0][0]
|
|
196
|
-
# return
|
|
197
|
-
|
|
198
|
-
# TODO what are the diff between csv_path and directory_name?
|
|
174
|
+
|
|
175
|
+
# What are the diff between csv_path and directory_name?
|
|
199
176
|
# ans: csv_path is the full path to the csv file, directory_name is the directory where the csv file is located
|
|
200
177
|
|
|
201
|
-
#
|
|
178
|
+
# I think file name should be after directory_name and csv_path
|
|
202
179
|
# ans: it cannot be after directory_name and csv_path because it is a required parameter
|
|
203
180
|
|
|
204
181
|
# TODO: break this function into smaller functions
|
|
@@ -227,7 +204,7 @@ class CSVToContactPersonProfile(
|
|
|
227
204
|
:return:
|
|
228
205
|
"""
|
|
229
206
|
data_source_type_name = DataSources().get_data_source_name_by_id(data_source_type_id)
|
|
230
|
-
#
|
|
207
|
+
# There can be multiple profiles with the same email, why not to query `user_external_table`.`main_profile_id`?
|
|
231
208
|
# Answer: first, We can't query tables with GenericCRUD, second, we may not find profile_id in user_external table
|
|
232
209
|
# and may have to insert a new record to user_external_table, in this case we need profile_id from profile_view
|
|
233
210
|
profile_id = self.select_one_value_by_column_and_value(
|
|
@@ -243,7 +220,6 @@ class CSVToContactPersonProfile(
|
|
|
243
220
|
self.logger.error("Couldn't find profile_id in profile_view by email_address.")
|
|
244
221
|
raise Exception("Couldn't find profile_id in user_external or profile_view.")
|
|
245
222
|
system_id = system_id or CONTACT_PERSON_PROFILE_CSV_SYSTEM_ID
|
|
246
|
-
self.set_schema(schema_name="field")
|
|
247
223
|
self.list_of_group_dicts = list_of_group_dicts if list_of_group_dicts else []
|
|
248
224
|
'''
|
|
249
225
|
profile_id = ProfilesLocal().select_one_value_by_column_and_value(
|
|
@@ -252,10 +228,9 @@ class CSVToContactPersonProfile(
|
|
|
252
228
|
column_value=user_external_username)
|
|
253
229
|
'''
|
|
254
230
|
self.logger.info(f"profile_id: {profile_id}")
|
|
255
|
-
# TODO Please explain
|
|
256
231
|
# if csv_path is provided then we will use the full path
|
|
257
232
|
# if csv_path is not provided then we will use the directory_name and file_name to create the full path
|
|
258
|
-
#
|
|
233
|
+
# If directory_name is not provided, the assumption is that the file is in the same directory as the script and not in a folder
|
|
259
234
|
if csv_path is not None:
|
|
260
235
|
csv_file_path = csv_path
|
|
261
236
|
else:
|
|
@@ -274,7 +249,7 @@ class CSVToContactPersonProfile(
|
|
|
274
249
|
|
|
275
250
|
user_external_id = self.__get_user_external_id(user_external_username=user_external_username,
|
|
276
251
|
profile_id=profile_id, system_id=system_id)
|
|
277
|
-
# We create a new data_source_instance_id
|
|
252
|
+
# We create a new data_source_instance_id every time we import a new csv file
|
|
278
253
|
data_source_instance_id = self.__get_data_source_instance_id(
|
|
279
254
|
data_source_type_id=data_source_type_id, csv_file_path=csv_file_path,
|
|
280
255
|
user_external_id=user_external_id, file_name=file_name,
|
|
@@ -346,6 +321,7 @@ class CSVToContactPersonProfile(
|
|
|
346
321
|
# contact_dict['last_name'] = process_last_name(
|
|
347
322
|
# original_last_name=contact_dict['last_name'])
|
|
348
323
|
|
|
324
|
+
|
|
349
325
|
# TODO This should be executed also by Google Contact Sync (please make sure it is in
|
|
350
326
|
# people-local-python-package i.e. get_display_name(first_name, last_name, organization) -> str
|
|
351
327
|
if contact_dict.get('display_as') is None:
|
|
@@ -356,7 +332,6 @@ class CSVToContactPersonProfile(
|
|
|
356
332
|
contact_dict['display_as'] += " " + contact_dict['last_name']
|
|
357
333
|
if not contact_dict['display_as'] and contact_dict.get('organization'):
|
|
358
334
|
contact_dict['display_as'] += " " + contact_dict['organization']
|
|
359
|
-
|
|
360
335
|
# TODO if contact_dict['display_as'] still empty raise?
|
|
361
336
|
|
|
362
337
|
# TODO process_notes( contact_dict[notes] )
|
|
@@ -379,8 +354,6 @@ class CSVToContactPersonProfile(
|
|
|
379
354
|
data_source_type_id=data_source_type_id)
|
|
380
355
|
contact_data_by_contact_id_dict[contact_id] = contact_dict
|
|
381
356
|
# groups_linked_by_job_title = process_job_title(contact_id=contact_id, job_title=contact_dict['job_title'])
|
|
382
|
-
# if groups_linked_by_job_title is None:
|
|
383
|
-
# logger.info("No groups linked by job title to contact " + str(contact_id))
|
|
384
357
|
|
|
385
358
|
return contact_data_by_contact_id_dict
|
|
386
359
|
|
|
@@ -618,7 +591,9 @@ class CSVToContactPersonProfile(
|
|
|
618
591
|
return linked_groups_results_list
|
|
619
592
|
|
|
620
593
|
def __insert_link_contact_persons(self, contact_dict: dict) -> dict:
|
|
594
|
+
# TODO create and use mandatory_fields_to_link_contact_to_person_array
|
|
621
595
|
if not contact_dict.get("first_name") and not contact_dict.get("last_name"):
|
|
596
|
+
# TODO logger.warning("Can't connect contact_id= contact.display_as= contact.organization to a person as we don't have first and last name
|
|
622
597
|
return {}
|
|
623
598
|
phones_local = PhonesLocal(is_test_data=self.is_test_data)
|
|
624
599
|
contact_phone_number = contact_dict.get("phone1")
|
|
@@ -637,7 +612,7 @@ class CSVToContactPersonProfile(
|
|
|
637
612
|
|
|
638
613
|
return contact_person_results_dict
|
|
639
614
|
|
|
640
|
-
# TODO This method is confusing me as based on the name I was
|
|
615
|
+
# TODO This method is confusing me, as based on the name, I was expecting to have two parameters
|
|
641
616
|
# contact_dict and email_addresses but we are sending profile_id, please explain or fix
|
|
642
617
|
def __insert_link_contact_email_addresses(self, contact_dict: dict) -> list[int]:
|
|
643
618
|
email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
|
|
@@ -676,24 +651,6 @@ class CSVToContactPersonProfile(
|
|
|
676
651
|
|
|
677
652
|
return contact_phone_ids
|
|
678
653
|
|
|
679
|
-
# old, TODO, do we need it?
|
|
680
|
-
def __insert_link_contact_user_external(self, contact_dict: dict) -> int:
|
|
681
|
-
contact_id = contact_dict.get("contact_id")
|
|
682
|
-
print("Before " + __name__, file=sys.stderr, flush=True)
|
|
683
|
-
contact_user_external_id = \
|
|
684
|
-
self.contact_user_external.insert_contact_and_link_to_existing_or_new_user_external(
|
|
685
|
-
contact_dict=contact_dict,
|
|
686
|
-
contact_email_address_str=contact_dict["email1"],
|
|
687
|
-
contact_id=contact_id,
|
|
688
|
-
system_id=contact_dict.get("system_id"),
|
|
689
|
-
# TODO What happends if contact do not have email?
|
|
690
|
-
# TODO I'm not sure we should use contact_dict["email1"] for user_external_dict["username"] probably bug
|
|
691
|
-
user_external_dict={"username": contact_dict["email1"]}
|
|
692
|
-
)
|
|
693
|
-
print("After " + __name__, file=sys.stderr, flush=True)
|
|
694
|
-
return contact_user_external_id
|
|
695
|
-
|
|
696
|
-
# new
|
|
697
654
|
def __insert_link_contact_user_external_by_contact_dict_and_user_external_dict(
|
|
698
655
|
self,
|
|
699
656
|
contact_dict: dict,
|
|
@@ -767,7 +724,7 @@ class CSVToContactPersonProfile(
|
|
|
767
724
|
# TODO merge this method with the method in google-contact-sync
|
|
768
725
|
def __insert_importer(self, contact_id: int, location_id: int, user_external_id: int,
|
|
769
726
|
data_source_type_id: int, data_source_instance_id: int) -> int:
|
|
770
|
-
# TODO: Shall we consider the url of
|
|
727
|
+
# TODO: Shall we consider the url of CSVs as the following? Use Sql2Code. Use const enum
|
|
771
728
|
if data_source_type_id == CSVToContactPersonProfileConstants.GOOGLE_CSV_DATA_SOURCE_TYPE_ID:
|
|
772
729
|
url = "www.google.com"
|
|
773
730
|
elif data_source_type_id == CSVToContactPersonProfileConstants.OUTLOOK_CSV_DATA_SOURCE_TYPE_ID:
|
|
@@ -792,10 +749,10 @@ class CSVToContactPersonProfile(
|
|
|
792
749
|
|
|
793
750
|
return importer_id
|
|
794
751
|
|
|
795
|
-
# TODO Move this method to ContactsLocal if not
|
|
752
|
+
# TODO Move this method to ContactsLocal if not already exist
|
|
796
753
|
def __procces_location_of_contact(self, contact_dict: dict) -> dict or None:
|
|
797
754
|
"""
|
|
798
|
-
Process location of Google contact
|
|
755
|
+
Process the location of the Google contact
|
|
799
756
|
:param contact_dict: location_dict
|
|
800
757
|
:return: location_dict
|
|
801
758
|
"""
|
|
@@ -824,6 +781,7 @@ class CSVToContactPersonProfile(
|
|
|
824
781
|
and not email_addresses_list):
|
|
825
782
|
return
|
|
826
783
|
# TODO: How can we add location type?
|
|
784
|
+
# TODO Rename to processed_location_dicts
|
|
827
785
|
proccessed_location_dicts = []
|
|
828
786
|
if is_contact_location1:
|
|
829
787
|
location_dict = self.__create_location_dict(
|
|
@@ -989,6 +947,7 @@ class CSVToContactPersonProfile(
|
|
|
989
947
|
@staticmethod
|
|
990
948
|
# TODO Move this function to python-sdk
|
|
991
949
|
def detect_encoding(file_path: str, data_source_type_id: int = None):
|
|
950
|
+
# TODO Do not use hard-coded values, get it from the data_source_type repo/package
|
|
992
951
|
if data_source_type_id in [16, 17, 18]:
|
|
993
952
|
detect_encodinfg_result = "utf-8"
|
|
994
953
|
else:
|
|
@@ -20,6 +20,7 @@ class CSVToContactPersonProfileConstants:
|
|
|
20
20
|
'developer_email': DEVELOPER_EMAIL
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
# TODO search for the source_type_id in the database and remove those constants
|
|
23
24
|
GOOGLE_CSV_DATA_SOURCE_TYPE_ID = 16
|
|
24
25
|
LINKEDIN_CSV_DATA_SOURCE_TYPE_ID = 18
|
|
25
26
|
OUTLOOK_CSV_DATA_SOURCE_TYPE_ID = 17
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: contact-person-profile-csv-imp-local
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.51
|
|
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.49 → contact_person_profile_csv_imp_local-0.0.51}/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.51', # https://pypi.org/project/contact-person-profile-csv-imp-local/
|
|
9
9
|
|
|
10
10
|
author="Circles",
|
|
11
11
|
author_email="info@circles.ai",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|