Skip to content

listerv check and reccomendation#4

Open
NikhillA wants to merge 1 commit into
mainfrom
listserv-check/Nikhill
Open

listerv check and reccomendation#4
NikhillA wants to merge 1 commit into
mainfrom
listserv-check/Nikhill

Conversation

@NikhillA

Copy link
Copy Markdown
Collaborator

Summary

This PR provides two different files. One is for detecting listserv emails indicated by a "-l" in their email signature and the other is an algorithm to reccomend specific events to different users based on shared tags between the events and the user's profile.

This pull request is the first step towards implementing the full listserv reccomendation process.

  • implemented detection and reccomendation
  • fixed Y

Remaining TODOs:

  • adapt to new database schema and fine tune.
  • implement Z

Depends on #{number of PR}

Test Plan

Notes

Breaking Changes

  • Database schema changes
  • Other change that could cause problems (Detailed in notes)

@benkoppe benkoppe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments, but I'm mostly curious about how everything work look & work with an extension as opposed to a typical project. All of this will probably look the same, I'm guessing? I think convex will also work perfectly. I also appreciate the lack of React useEffects, we should definitely avoid it as much as possible.

Comment thread convex/listserv.ts
@@ -0,0 +1,40 @@
import React from "react";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import required when it's unused? Genuinely asking BTW I don't use react that much haha

Comment thread convex/reccomendation.ts
@@ -0,0 +1,74 @@
import React from "react";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this import

Comment thread convex/listserv.ts

export default function App() {
//Example emails
const emails = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably already start putting mock data in the convex similar to what they do in the quickstart if we want

Comment thread convex/listserv.ts
"friend@gmail.com"
];
//Will need to be modified depending on our database schema
function detectListserv(emails) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all functions need to be defined with useMemo in react? Or is that an anti-pattern.

Comment thread convex/listserv.ts
function detectListserv(emails) {
const results = [];

for (const email of emails) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless of my above comment, when our state is defined with convex in the future this will probably need to be derived state with useMemo.

@anchen9 anchen9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work overall! I can really see how the functions are coming together!

Comment thread convex/listserv.ts

const results = detectListserv(emails);

return (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Nikhill! Great work on researching the recommendation algorithms and listserv detection so far! For the future, it's good practice to try and keep the frontend and backend responsibilities more separate (i.e. only functions in the convex folder)! Of course just for prototyping and quick testing it's fine, but I think testing with just json input and printing the output to terminal is a good quick alternative just to check if your function is producing the results you want!

Comment thread convex/listserv.ts
const username = email.split("@")[0];

if (username.includes("-l")) {
results.push("LISTSERV");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if pushing a boolean to results for detecting isListserv might be more maintainable for the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants