-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from prentice-jobs/feat/integration-ml
Feat: RecSys integration to Backend
- Loading branch information
Showing
25 changed files
with
1,296 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
alembic/versions/0b7939b453d5_create_recsys_sim_scores_and_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
"""create recsys sim_scores and recommendation cache tables | ||
Revision ID: 0b7939b453d5 | ||
Revises: fa73e6dafaad | ||
Create Date: 2024-06-18 13:34:44.532365 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '0b7939b453d5' | ||
down_revision: Union[str, None] = 'fa73e6dafaad' | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
'user_review_similarity_scores', | ||
sa.Column('id', sa.UUID(), autoincrement=False), | ||
sa.Column('created_at', sa.TIMESTAMP(timezone=True)), | ||
sa.Column('updated_at', sa.TIMESTAMP(timezone=True)), | ||
sa.Column('is_deleted', sa.Boolean()), | ||
|
||
sa.Column('user_id', sa.UUID()), | ||
sa.Column('review_id', sa.UUID()), | ||
sa.Column('sim_score', sa.Float(precision=3)), | ||
|
||
sa.PrimaryKeyConstraint('id'), | ||
sa.ForeignKeyConstraint( | ||
["user_id"], ["users.id"], | ||
name="fk_sim_scores_user", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["review_id"], ["company_reviews.id"], | ||
name="fk_sim_scores_review", | ||
) | ||
) | ||
|
||
op.create_table( | ||
'user_review_recommendations_cache', | ||
sa.Column('id', sa.UUID(), autoincrement=False), | ||
sa.Column('created_at', sa.TIMESTAMP(timezone=True)), | ||
sa.Column('updated_at', sa.TIMESTAMP(timezone=True)), | ||
sa.Column('is_deleted', sa.Boolean()), | ||
|
||
sa.Column('user_id', sa.UUID()), | ||
sa.Column('review_id', sa.UUID()), | ||
sa.Column('sim_score', sa.Float(precision=3)), | ||
|
||
sa.PrimaryKeyConstraint('id'), | ||
sa.ForeignKeyConstraint( | ||
["user_id"], ["users.id"], | ||
name="fk_sim_scores_user", | ||
), | ||
sa.ForeignKeyConstraint( | ||
["review_id"], ["company_reviews.id"], | ||
name="fk_sim_scores_review", | ||
) | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table('user_review_recommendations_cache') | ||
op.drop_table('user_review_similarity_scores') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
SERVICE_CREATE_USER_SUCCESS = "Successfully created user." | ||
CREATE_NEW_USER_SUCCESS = "Successfully created user." | ||
SAVE_USER_PREFERENCES_SUCCESS = "Successfully saved user preferences." | ||
|
||
UNAUTHORIZED_ACTION = "Unauthorized: Failed to perform this operation." | ||
UNAUTHORIZED_ACTION_RECOMMENDATION = "You are not logged in. Try logging in with the required permissions." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.