Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: RecSys integration to Backend #15

Merged
merged 27 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3c6e2a1
feat: create migration for recsys integration
jeremyalv Jun 18, 2024
ba442ab
Merge branch 'dev' of https://github.com/prentice-jobs/prentice-api i…
jeremyalv Jun 18, 2024
d6b53ec
feat: update GCS service
jeremyalv Jun 18, 2024
910944c
refactor: import naming
jeremyalv Jun 18, 2024
da95319
feat: review recommendation service checkpoint
jeremyalv Jun 18, 2024
19fbf6d
feat: implement high level service methods for RecSys
jeremyalv Jun 18, 2024
c77c4aa
fix: add PK constraint in alembic migrations
jeremyalv Jun 19, 2024
bf1b54d
feat: create RecSys helper methods and core method logic skeleton
jeremyalv Jun 19, 2024
a09de30
fix: update ML algorithm
jeremyalv Jun 19, 2024
9eb4d2e
feat: schema for recsys Algorithm 1
jeremyalv Jun 19, 2024
145e8f8
feat: implement happy path logic for RecSys Algorithm #1
jeremyalv Jun 19, 2024
fe25148
refactor: change ML Algo to private methods, extract method
jeremyalv Jun 19, 2024
22d96d0
fix: change UserPreferences fields to be non-nullable
jeremyalv Jun 19, 2024
c311b34
fix: add UserPreferences schema and removed is_active
jeremyalv Jun 19, 2024
d6a8fec
feat: create Save User Preferences API
jeremyalv Jun 19, 2024
ecd83be
refactor: RecSys exceptions
jeremyalv Jun 19, 2024
404a839
fix: raise exception when there are no reviews in platform
jeremyalv Jun 19, 2024
2f86d89
feat: add RecSys Algo 1 API, working up to before calling pd.read_sql()
jeremyalv Jun 19, 2024
078c8cd
feat: RecSys Algo 1 completely integrated
jeremyalv Jun 19, 2024
45888e5
feat: adjust __compute_similarity_for_new_review to pydantic schemas
jeremyalv Jun 19, 2024
27828d0
feat: ML Algo #2 API integration complete
jeremyalv Jun 19, 2024
d5df17b
feat: recommend_reviews succesfully returns response
jeremyalv Jun 20, 2024
3f74acd
fix: Algo 3 fix to not group recos based on role, and round floating …
jeremyalv Jun 20, 2024
b09eed7
feat: mirror /reviews/feed to /reviews/recsys as recommender API
jeremyalv Jun 20, 2024
d7a0a90
feat: integrate RecSys SimScore matrix recomputation to Account and …
jeremyalv Jun 20, 2024
f2dd63a
Merge branch 'dev' of https://github.com/prentice-jobs/prentice-api i…
jeremyalv Jun 20, 2024
6ea2ec1
feat: finished integration with RecSys
jeremyalv Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: mirror /reviews/feed to /reviews/recsys as recommender API
  • Loading branch information
jeremyalv committed Jun 20, 2024
commit b09eed704b42e862847c06a57719a762c71b0c8c
25 changes: 21 additions & 4 deletions src/review/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,28 @@ def recommend_reviews(

@review_router.get("/feed", status_code=HTTPStatus.OK, response_model=GenericAPIResponseModel)
def fetch_user_feed(
# TODO add arguments based on ML model spec
user: User = Depends(get_current_user),
session: Session = Depends(get_db),
):
response: GenericAPIResponseModel = ReviewService.fetch_feed()

return build_api_response(response)
try:
# Hyperparameter for recommendation list length
TOP_N = 7

response: GenericAPIResponseModel = RecommendationService.recommend_reviews(
user=user,
session=session,
top_n=TOP_N,
)

return build_api_response(response)
except Exception as err:
response = GenericAPIResponseModel(
status=HTTPStatus.INTERNAL_SERVER_ERROR,
message=err.__str__(),
error=err.__str__()
)

return build_api_response(response)

@review_router.post("/", status_code=HTTPStatus.CREATED, response_model=GenericAPIResponseModel)
def create_new_review(
Expand Down
9 changes: 0 additions & 9 deletions src/review/services/review_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@

class ReviewService:
# Business Logic methods
@classmethod
def fetch_feed(cls):
# TODO integrate with ML model response
return GenericAPIResponseModel(
status=HTTPStatus.OK,
message="Successfully fetched Review recommendations",
data=FEED_REVIEWS_DUMMY,
)

@classmethod
def fetch_review(
cls,
Expand Down