Skip to content

Commit

Permalink
Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryRyumin committed Aug 28, 2024
1 parent 036f3a9 commit 49eb422
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion oceanai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
__uri__ = "https://github.com/DmitryRyumin/oceanai"

__version__ = "1.0"
__release__ = __version__ + ".0a30"
__release__ = __version__ + ".0a31"

__author__ru__ = "Рюмина Елена, Рюмин Дмитрий, Карпов Алексей"
__author__en__ = "Elena Ryumina, Dmitry Ryumin, Alexey Karpov"
Expand Down
13 changes: 7 additions & 6 deletions oceanai/modules/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3928,9 +3928,10 @@ def _priority_skill_calculation(
else:
return self._df_files_priority_skill

def _compatibility_percentage(self, type1, type2):
count = sum(1 for x, y in zip(type1, type2) if x == y)
return count / 4 * 100
def _compatibility_percentage(self, type1, type2, weights):
match = sum(1 for x, y in zip(type1, type2) if x == y) / 4
score = sum(np.abs(weights[idx]) for idx, (x, y) in enumerate(zip(type1, type2)) if x == y)
return match * 100, score * match

def _professional_match(
self,
Expand Down Expand Up @@ -4010,7 +4011,7 @@ def _professional_match(
]
)

match = self._compatibility_percentage(need_type, personality_type)
match, score = self._compatibility_percentage(need_type, personality_type, curr_weights)

score = np.sum(np.abs(curr_weights))

Expand All @@ -4020,7 +4021,7 @@ def _professional_match(
] = curr_weights.tolist() + [personality_type, score, match]

self._df_files_MBTI_job_match = self._df_files_MBTI_job_match.sort_values(
by=["Match", "MBTI", "MBTI_Score"], ascending=False
by=["MBTI_Score"], ascending=False
)

self._df_files_MBTI_job_match.index.name = self._keys_id
Expand Down Expand Up @@ -4129,7 +4130,7 @@ def _colleague_personality_type_match(
]
)

match = self._compatibility_percentage(target_personality_type, personality_type)
match, _ = self._compatibility_percentage(target_personality_type, personality_type)

self._df_files_MBTI_colleague_match.loc[
str(path + 1),
Expand Down
10 changes: 8 additions & 2 deletions oceanai/modules/lab/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,14 +470,21 @@ def _download_file_from_url(
# https://requests.readthedocs.io/en/master/_modules/requests/exceptions/
requests.exceptions.MissingSchema,
requests.exceptions.InvalidSchema,
requests.exceptions.ConnectionError,
# requests.exceptions.ConnectionError,
requests.exceptions.InvalidURL,
):
self._other_error(self._could_not_process_url, out=out)
return 404
except requests.exceptions.ConnectionError:
url_filename = url.split("=")[-1]
local_file = os.path.join(self.path_to_save_, url_filename)
self._url_last_filename = local_file
return 200

except Exception:
self._other_error(self._unknown_err, out=out)
return 404

else:
# Имя файла
if "Content-Disposition" in r.headers.keys():
Expand Down Expand Up @@ -603,7 +610,6 @@ def _download_file_from_url(
),
out=out,
)

return 404
finally:
if runtime:
Expand Down

0 comments on commit 49eb422

Please sign in to comment.