contact-person-profile-csv-imp-local 0.0.52__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.
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/PKG-INFO +2 -2
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local/src/CSVToContactPersonProfile.py +40 -59
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/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.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/PKG-INFO +2 -2
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/requires.txt +1 -1
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/setup.py +2 -2
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/README.md +0 -0
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local/src/__init__.py +0 -0
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/SOURCES.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/dependency_links.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/contact_person_profile_csv_imp_local.egg-info/top_level.txt +0 -0
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/pyproject.toml +0 -0
- {contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/setup.cfg +0 -0
{contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/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.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
|
|
@@ -12,7 +12,7 @@ Requires-Dist: contact-local>=0.0.48
|
|
|
12
12
|
Requires-Dist: logger-local>=0.0.135
|
|
13
13
|
Requires-Dist: database-mysql-local>=0.1.1
|
|
14
14
|
Requires-Dist: user-context-remote>=0.0.77
|
|
15
|
-
Requires-Dist: contact-email-address-local>=0.0.
|
|
15
|
+
Requires-Dist: contact-email-address-local>=0.0.40.1234
|
|
16
16
|
Requires-Dist: contact-group-local>=0.0.68
|
|
17
17
|
Requires-Dist: contact-location-local>=0.0.14
|
|
18
18
|
Requires-Dist: contact-notes-local>=0.0.33
|
|
@@ -50,13 +50,32 @@ DEFAULT_PROFILE_ID = 0
|
|
|
50
50
|
|
|
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
|
+
# TODO def process_first_name( original_first_name: str) -> str: (move to people-local-python-package)
|
|
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
|
+
|
|
58
|
+
# TODO def process_last_name( original_last_name : str) -> str: (move to people-local-python-package)
|
|
59
|
+
# normalized_last_name = Remove all the digits from the last name
|
|
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
|
+
|
|
62
|
+
# TODO def process_phone( original_phone_number: str) -> str: (move to phone-local-python-package)
|
|
63
|
+
# phone_id, normalized_phone = PhonesLocal.link_phone_to_contact( normilized_phone, contact_id) # Please use method written by @akiva and return normalized_phone_number
|
|
64
|
+
|
|
65
|
+
# TODO def process_job_title( job_title: str) -> str: (move to people-local-python-package)
|
|
66
|
+
# normalized_job_title = GroupsLocal.add_update_group_and_link_to_contact( job_title, is_group=true, contact_id) # When checking if exists, ignore the upper-case lower-case, return the value with is_main == true
|
|
67
|
+
|
|
68
|
+
# TODO def process_email_address( email_address: str)
|
|
69
|
+
# """ Returned email_address_id, domain_name, organization_name """
|
|
70
|
+
# DomainsLocal.link_contact_to_domain( contact_id, domain_name )
|
|
71
|
+
|
|
53
72
|
# TODO def process_organization( organization_name: str, email_address: str) -> str: (move to people-local-python-package
|
|
54
73
|
# if organization_name == None or empty
|
|
55
74
|
# organization_name = extract_organization_from_email_address( email_address)
|
|
56
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
|
|
57
76
|
|
|
58
77
|
# TODO def process_department( department_name: str) -> str: (move to people-local-python-package
|
|
59
|
-
# 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
|
|
60
79
|
|
|
61
80
|
# TODO def process_continent( continent_name: str) -> str: (move to location-local-python-package)
|
|
62
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
|
|
@@ -105,10 +124,10 @@ class CSVToContactPersonProfile(
|
|
|
105
124
|
'contact_location', 'user_externals_local',
|
|
106
125
|
'organizations_local', 'domain_local',
|
|
107
126
|
'importers_local']
|
|
108
|
-
GenericCRUD.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
default_view_table_name="
|
|
127
|
+
# TODO Can we remove the GenericCRUD inheritance and create self.profile_local
|
|
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
|
|
130
|
+
default_view_table_name="profile_view",
|
|
112
131
|
is_test_data=is_test_data)
|
|
113
132
|
self.contact_entity_type_id = \
|
|
114
133
|
self.select_one_value_by_column_and_value(
|
|
@@ -154,32 +173,11 @@ class CSVToContactPersonProfile(
|
|
|
154
173
|
# Otherwise, return the value
|
|
155
174
|
return value
|
|
156
175
|
|
|
157
|
-
|
|
158
|
-
#
|
|
159
|
-
# """
|
|
160
|
-
# Get the field name from the database
|
|
161
|
-
# :param field_id: The field ID
|
|
162
|
-
# :param data_source_type_id: The data source ID
|
|
163
|
-
# :return: The field name
|
|
164
|
-
# """
|
|
165
|
-
#
|
|
166
|
-
# 'data_source_type_id': data_source_type_id})
|
|
167
|
-
|
|
168
|
-
# self.set_schema(schema_name="data_source_field")
|
|
169
|
-
# data_source_field_tuples = self.select_multi_tuple_by_where(view_table_name="data_source_field_view",
|
|
170
|
-
# select_clause_value="external_field_name",
|
|
171
|
-
# where="data_source_type_id = %s AND field_id = %s",
|
|
172
|
-
# params=(data_source_type_id, field_id))
|
|
173
|
-
|
|
174
|
-
# if data_source_field_tuples:
|
|
175
|
-
#
|
|
176
|
-
# return data_source_field_tuples[0][0]
|
|
177
|
-
# return
|
|
178
|
-
|
|
179
|
-
# TODO what are the diff between csv_path and directory_name?
|
|
176
|
+
|
|
177
|
+
# What are the diff between csv_path and directory_name?
|
|
180
178
|
# ans: csv_path is the full path to the csv file, directory_name is the directory where the csv file is located
|
|
181
179
|
|
|
182
|
-
#
|
|
180
|
+
# I think file name should be after directory_name and csv_path
|
|
183
181
|
# ans: it cannot be after directory_name and csv_path because it is a required parameter
|
|
184
182
|
|
|
185
183
|
# TODO: break this function into smaller functions
|
|
@@ -208,9 +206,10 @@ class CSVToContactPersonProfile(
|
|
|
208
206
|
:return:
|
|
209
207
|
"""
|
|
210
208
|
data_source_type_name = DataSources().get_data_source_name_by_id(data_source_type_id)
|
|
211
|
-
#
|
|
209
|
+
# There can be multiple profiles with the same email, why not to query `user_external_table`.`main_profile_id`?
|
|
212
210
|
# Answer: first, We can't query tables with GenericCRUD, second, we may not find profile_id in user_external table
|
|
213
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(
|
|
214
213
|
profile_id = self.select_one_value_by_column_and_value(
|
|
215
214
|
schema_name="user_external", view_table_name="user_external_view",
|
|
216
215
|
select_clause_value="main_profile_id", column_name="username",
|
|
@@ -224,7 +223,6 @@ class CSVToContactPersonProfile(
|
|
|
224
223
|
self.logger.error("Couldn't find profile_id in profile_view by email_address.")
|
|
225
224
|
raise Exception("Couldn't find profile_id in user_external or profile_view.")
|
|
226
225
|
system_id = system_id or CONTACT_PERSON_PROFILE_CSV_SYSTEM_ID
|
|
227
|
-
self.set_schema(schema_name="field")
|
|
228
226
|
self.list_of_group_dicts = list_of_group_dicts if list_of_group_dicts else []
|
|
229
227
|
'''
|
|
230
228
|
profile_id = ProfilesLocal().select_one_value_by_column_and_value(
|
|
@@ -233,10 +231,9 @@ class CSVToContactPersonProfile(
|
|
|
233
231
|
column_value=user_external_username)
|
|
234
232
|
'''
|
|
235
233
|
self.logger.info(f"profile_id: {profile_id}")
|
|
236
|
-
# TODO Please explain
|
|
237
234
|
# if csv_path is provided then we will use the full path
|
|
238
235
|
# if csv_path is not provided then we will use the directory_name and file_name to create the full path
|
|
239
|
-
#
|
|
236
|
+
# 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
|
|
240
237
|
if csv_path is not None:
|
|
241
238
|
csv_file_path = csv_path
|
|
242
239
|
else:
|
|
@@ -255,7 +252,7 @@ class CSVToContactPersonProfile(
|
|
|
255
252
|
|
|
256
253
|
user_external_id = self.__get_user_external_id(user_external_username=user_external_username,
|
|
257
254
|
profile_id=profile_id, system_id=system_id)
|
|
258
|
-
# We create a new data_source_instance_id
|
|
255
|
+
# We create a new data_source_instance_id every time we import a new csv file
|
|
259
256
|
data_source_instance_id = self.__get_data_source_instance_id(
|
|
260
257
|
data_source_type_id=data_source_type_id, csv_file_path=csv_file_path,
|
|
261
258
|
user_external_id=user_external_id, file_name=file_name,
|
|
@@ -327,6 +324,7 @@ class CSVToContactPersonProfile(
|
|
|
327
324
|
# contact_dict['last_name'] = process_last_name(
|
|
328
325
|
# original_last_name=contact_dict['last_name'])
|
|
329
326
|
|
|
327
|
+
|
|
330
328
|
# TODO This should be executed also by Google Contact Sync (please make sure it is in
|
|
331
329
|
# people-local-python-package i.e. get_display_name(first_name, last_name, organization) -> str
|
|
332
330
|
if contact_dict.get('display_as') is None:
|
|
@@ -337,7 +335,6 @@ class CSVToContactPersonProfile(
|
|
|
337
335
|
contact_dict['display_as'] += " " + contact_dict['last_name']
|
|
338
336
|
if not contact_dict['display_as'] and contact_dict.get('organization'):
|
|
339
337
|
contact_dict['display_as'] += " " + contact_dict['organization']
|
|
340
|
-
|
|
341
338
|
# TODO if contact_dict['display_as'] still empty raise?
|
|
342
339
|
|
|
343
340
|
# TODO process_notes( contact_dict[notes] )
|
|
@@ -360,8 +357,6 @@ class CSVToContactPersonProfile(
|
|
|
360
357
|
data_source_type_id=data_source_type_id)
|
|
361
358
|
contact_data_by_contact_id_dict[contact_id] = contact_dict
|
|
362
359
|
# groups_linked_by_job_title = process_job_title(contact_id=contact_id, job_title=contact_dict['job_title'])
|
|
363
|
-
# if groups_linked_by_job_title is None:
|
|
364
|
-
# logger.info("No groups linked by job title to contact " + str(contact_id))
|
|
365
360
|
|
|
366
361
|
return contact_data_by_contact_id_dict
|
|
367
362
|
|
|
@@ -599,7 +594,9 @@ class CSVToContactPersonProfile(
|
|
|
599
594
|
return linked_groups_results_list
|
|
600
595
|
|
|
601
596
|
def __insert_link_contact_persons(self, contact_dict: dict) -> dict:
|
|
597
|
+
# TODO create and use mandatory_fields_to_link_contact_to_person_array
|
|
602
598
|
if not contact_dict.get("first_name") and not contact_dict.get("last_name"):
|
|
599
|
+
# 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
|
|
603
600
|
return {}
|
|
604
601
|
phones_local = PhonesLocal(is_test_data=self.is_test_data)
|
|
605
602
|
contact_phone_number = contact_dict.get("phone1")
|
|
@@ -618,7 +615,7 @@ class CSVToContactPersonProfile(
|
|
|
618
615
|
|
|
619
616
|
return contact_person_results_dict
|
|
620
617
|
|
|
621
|
-
# TODO This method is confusing me as based on the name I was
|
|
618
|
+
# TODO This method is confusing me, as based on the name, I was expecting to have two parameters
|
|
622
619
|
# contact_dict and email_addresses but we are sending profile_id, please explain or fix
|
|
623
620
|
def __insert_link_contact_email_addresses(self, contact_dict: dict) -> list[int]:
|
|
624
621
|
email_addresses = self.contacts_local.get_contact_email_addresses_from_contact_dict(
|
|
@@ -657,24 +654,6 @@ class CSVToContactPersonProfile(
|
|
|
657
654
|
|
|
658
655
|
return contact_phone_ids
|
|
659
656
|
|
|
660
|
-
# old, TODO, do we need it?
|
|
661
|
-
def __insert_link_contact_user_external(self, contact_dict: dict) -> int:
|
|
662
|
-
contact_id = contact_dict.get("contact_id")
|
|
663
|
-
print("Before " + __name__, file=sys.stderr, flush=True)
|
|
664
|
-
contact_user_external_id = \
|
|
665
|
-
self.contact_user_external.insert_contact_and_link_to_existing_or_new_user_external(
|
|
666
|
-
contact_dict=contact_dict,
|
|
667
|
-
contact_email_address_str=contact_dict["email1"],
|
|
668
|
-
contact_id=contact_id,
|
|
669
|
-
system_id=contact_dict.get("system_id"),
|
|
670
|
-
# TODO What happends if contact do not have email?
|
|
671
|
-
# TODO I'm not sure we should use contact_dict["email1"] for user_external_dict["username"] probably bug
|
|
672
|
-
user_external_dict={"username": contact_dict["email1"]}
|
|
673
|
-
)
|
|
674
|
-
print("After " + __name__, file=sys.stderr, flush=True)
|
|
675
|
-
return contact_user_external_id
|
|
676
|
-
|
|
677
|
-
# new
|
|
678
657
|
def __insert_link_contact_user_external_by_contact_dict_and_user_external_dict(
|
|
679
658
|
self,
|
|
680
659
|
contact_dict: dict,
|
|
@@ -762,7 +741,7 @@ class CSVToContactPersonProfile(
|
|
|
762
741
|
# TODO merge this method with the method in google-contact-sync
|
|
763
742
|
def __insert_importer(self, contact_id: int, location_id: int, user_external_id: int,
|
|
764
743
|
data_source_type_id: int, data_source_instance_id: int) -> int:
|
|
765
|
-
# TODO: Shall we consider the url of
|
|
744
|
+
# TODO: Shall we consider the url of CSVs as the following? Use Sql2Code. Use const enum
|
|
766
745
|
if data_source_type_id == CSVToContactPersonProfileConstants.GOOGLE_CSV_DATA_SOURCE_TYPE_ID:
|
|
767
746
|
url = "www.google.com"
|
|
768
747
|
elif data_source_type_id == CSVToContactPersonProfileConstants.OUTLOOK_CSV_DATA_SOURCE_TYPE_ID:
|
|
@@ -787,10 +766,10 @@ class CSVToContactPersonProfile(
|
|
|
787
766
|
|
|
788
767
|
return importer_id
|
|
789
768
|
|
|
790
|
-
# TODO Move this method to ContactsLocal if not
|
|
769
|
+
# TODO Move this method to ContactsLocal if not already exist
|
|
791
770
|
def __procces_location_of_contact(self, contact_dict: dict) -> dict or None:
|
|
792
771
|
"""
|
|
793
|
-
Process location of Google contact
|
|
772
|
+
Process the location of the Google contact
|
|
794
773
|
:param contact_dict: location_dict
|
|
795
774
|
:return: location_dict
|
|
796
775
|
"""
|
|
@@ -819,6 +798,7 @@ class CSVToContactPersonProfile(
|
|
|
819
798
|
and not email_addresses_list):
|
|
820
799
|
return
|
|
821
800
|
# TODO: How can we add location type?
|
|
801
|
+
# TODO Rename to processed_location_dicts
|
|
822
802
|
proccessed_location_dicts = []
|
|
823
803
|
if is_contact_location1:
|
|
824
804
|
location_dict = self.__create_location_dict(
|
|
@@ -984,6 +964,7 @@ class CSVToContactPersonProfile(
|
|
|
984
964
|
@staticmethod
|
|
985
965
|
# TODO Move this function to python-sdk
|
|
986
966
|
def detect_encoding(file_path: str, data_source_type_id: int = None):
|
|
967
|
+
# TODO Do not use hard-coded values, get it from the data_source_type repo/package
|
|
987
968
|
if data_source_type_id in [16, 17, 18]:
|
|
988
969
|
detect_encodinfg_result = "utf-8"
|
|
989
970
|
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.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
|
|
@@ -12,7 +12,7 @@ Requires-Dist: contact-local>=0.0.48
|
|
|
12
12
|
Requires-Dist: logger-local>=0.0.135
|
|
13
13
|
Requires-Dist: database-mysql-local>=0.1.1
|
|
14
14
|
Requires-Dist: user-context-remote>=0.0.77
|
|
15
|
-
Requires-Dist: contact-email-address-local>=0.0.
|
|
15
|
+
Requires-Dist: contact-email-address-local>=0.0.40.1234
|
|
16
16
|
Requires-Dist: contact-group-local>=0.0.68
|
|
17
17
|
Requires-Dist: contact-location-local>=0.0.14
|
|
18
18
|
Requires-Dist: contact-notes-local>=0.0.33
|
|
@@ -2,7 +2,7 @@ contact-local>=0.0.48
|
|
|
2
2
|
logger-local>=0.0.135
|
|
3
3
|
database-mysql-local>=0.1.1
|
|
4
4
|
user-context-remote>=0.0.77
|
|
5
|
-
contact-email-address-local>=0.0.
|
|
5
|
+
contact-email-address-local>=0.0.40.1234
|
|
6
6
|
contact-group-local>=0.0.68
|
|
7
7
|
contact-location-local>=0.0.14
|
|
8
8
|
contact-notes-local>=0.0.33
|
{contact_person_profile_csv_imp_local-0.0.52 → contact_person_profile_csv_imp_local-0.0.55}/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.55', # https://pypi.org/project/contact-person-profile-csv-imp-local/
|
|
9
9
|
|
|
10
10
|
author="Circles",
|
|
11
11
|
author_email="info@circles.ai",
|
|
@@ -26,7 +26,7 @@ setuptools.setup(
|
|
|
26
26
|
'logger-local>=0.0.135',
|
|
27
27
|
'database-mysql-local>=0.1.1',
|
|
28
28
|
'user-context-remote>=0.0.77',
|
|
29
|
-
'contact-email-address-local>=0.0.
|
|
29
|
+
'contact-email-address-local>=0.0.40.1234',
|
|
30
30
|
'contact-group-local>=0.0.68',
|
|
31
31
|
'contact-location-local>=0.0.14',
|
|
32
32
|
'contact-notes-local>=0.0.33',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|