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

category in fit score #28

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 17 additions & 16 deletions backend/api/fit_score/fit_score.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,45 @@ Deno.test("/api/fit-score - with keywords", async () => {
const response = JSON.parse(ctx.response.body as string);
assertEquals(response.isError, false);
assertEquals(response.message, "success");
type FeedbackType = { feedback: string; category: string };
assert(
response.feedback.find((feedback: string) =>
feedback.includes("missing1")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("missing1")
) != undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("missing2")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("missing2")
) != undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("missing3")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("missing3")
) != undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("missing4")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("missing4")
) != undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("notmissing1")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("notmissing1")
) == undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("notmissing2")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("notmissing2")
) == undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("unused1")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("unused1")
) == undefined,
);
assert(
response.feedback.find((feedback: string) =>
feedback.includes("unused2")
response.feedback.find((feedback: FeedbackType) =>
feedback.feedback.includes("unused2")
) == undefined,
);
assertAlmostEquals(response.fitScore, 33.3333333);
Expand Down
9 changes: 6 additions & 3 deletions backend/api/fit_score/fit_score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export function getMatchedSkills(
export function generateFeedback(
resumeKeywords: string[],
jobDescriptionKeywords: { niceToHave: string[]; mustHave: string[] },
) {
): {
feedback: string;
category: string;
}[] {
const resume = new Set(resumeKeywords);
const mustHave = new Set(jobDescriptionKeywords.mustHave);
const niceToHave = new Set(jobDescriptionKeywords.niceToHave);
Expand Down Expand Up @@ -108,8 +111,8 @@ export function generateFeedback(
} else if (r < 0.75) {
return `Knowing ${keyword} would make you stand out`;
} else {
return `Include ${keyword} in your resume`;
return `Including ${keyword} in your resume would help you`;
}
}),
);
).map((feedback) => ({ feedback, category: "experience" }));
}
11 changes: 10 additions & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,16 @@ Must be logged in.
"message": "success",
"fitScore": 0.5,
"matchedSkills": ["skills", "that", "were", "found", "in", "resume and job description"],
"feedback": ["include experience with apple computer", "do a project with steve jobs"],
"feedback": [
{
"feedback": "show experience with computer.",
"category": "skills"
},
{
"feedback": "demonstrate that you understand computer.",
"category": "skills"
}
],
}
```
- **Error (`400 Bad Request`):**
Expand Down
Loading