feat(matching): rank with semantic embeddings and explain matches by evidence
This commit is contained in:
1 parent
facc1789b1
commit
24b64d698a
215 files changed
+16951
-327
No files matched your search
@@ -191,6 +191,14 @@ type candidateViewRoleClaim struct {
|
||||
status ProfileClaimStatus
|
||||
}
|
||||
|
||||
// candidateViewProjectClaim is a project with the verification of its
|
||||
// repository. The repository key never leaves the private projection input.
|
||||
type candidateViewProjectClaim struct {
|
||||
value ProfileProject
|
||||
status ProfileClaimStatus
|
||||
verified bool
|
||||
}
|
||||
|
||||
type candidateViewExperienceClaim struct {
|
||||
startedOn string
|
||||
endedOn string
|
||||
@@ -204,6 +212,7 @@ type CandidateViewProfile struct {
|
||||
stack []candidateViewStackClaim
|
||||
roles []candidateViewRoleClaim
|
||||
experience []candidateViewExperienceClaim
|
||||
projects []candidateViewProjectClaim
|
||||
}
|
||||
|
||||
func (CandidateViewProfile) String() string { return "[candidate view profile]" }
|
||||
@@ -213,9 +222,28 @@ func (CandidateViewProfile) LogValue() slog.Value {
|
||||
}
|
||||
|
||||
// CandidateViewProfileFromContent removes private profile values that are
|
||||
// not needed to build the anonymous organization-facing view.
|
||||
// not needed to build the anonymous organization-facing view. No project is
|
||||
// marked as backed by a verified repository.
|
||||
func CandidateViewProfileFromContent(content CandidateProfileContent) CandidateViewProfile {
|
||||
return CandidateViewProfileFromContentWithRepositories(content, nil)
|
||||
}
|
||||
|
||||
// CandidateViewProfileFromContentWithRepositories also marks each project
|
||||
// whose repository key is in verifiedRepositories, the keys whose latest
|
||||
// check found a public repository.
|
||||
func CandidateViewProfileFromContentWithRepositories(
|
||||
content CandidateProfileContent, verifiedRepositories map[string]bool,
|
||||
) CandidateViewProfile {
|
||||
profile := CandidateViewProfile{}
|
||||
for _, claim := range content.Projects() {
|
||||
verified := false
|
||||
if repository, ok := claim.Value().Repository(); ok {
|
||||
verified = verifiedRepositories[repository.Key()]
|
||||
}
|
||||
profile.projects = append(profile.projects, candidateViewProjectClaim{
|
||||
value: claim.Value(), status: claim.Status(), verified: verified,
|
||||
})
|
||||
}
|
||||
for _, claim := range content.Stack() {
|
||||
profile.stack = append(profile.stack, candidateViewStackClaim{value: claim.Value(), status: claim.Status()})
|
||||
}
|
||||
@@ -263,6 +291,15 @@ func (compatibility CandidateViewSalaryCompatibility) IsKnown() bool {
|
||||
return compatibility == CandidateViewSalaryCompatible || compatibility == CandidateViewSalaryNotCompatible
|
||||
}
|
||||
|
||||
// CandidateViewProject is one published project as the card shows it: no
|
||||
// repository address, owner, or fetched repository text.
|
||||
type CandidateViewProject struct {
|
||||
Title string `json:"title"`
|
||||
Description *string `json:"description"`
|
||||
Stack []string `json:"stack"`
|
||||
RepositoryVerified bool `json:"repository_verified"`
|
||||
}
|
||||
|
||||
// AnonymousCandidateViewDTO is the complete closed organization-facing data
|
||||
// transfer object. It contains no account ID, raw profile fields, or history.
|
||||
type AnonymousCandidateViewDTO struct {
|
||||
@@ -273,6 +310,9 @@ type AnonymousCandidateViewDTO struct {
|
||||
ExperienceBand *CandidateExperienceBand `json:"experience_band"`
|
||||
WorkFormats []QuestionnaireWorkFormat `json:"work_formats"`
|
||||
SalaryCompatibility *CandidateViewSalaryCompatibility `json:"salary_compatibility"`
|
||||
// Projects are published free text; cohort generalization leaves them
|
||||
// unchanged and they are not a cohort feature.
|
||||
Projects []CandidateViewProject `json:"projects"`
|
||||
}
|
||||
|
||||
func (AnonymousCandidateViewDTO) String() string { return "[anonymous candidate view]" }
|
||||
@@ -348,6 +388,9 @@ func NewAnonymousCandidateView(input CandidateViewInput) (AnonymousCandidateView
|
||||
value := *input.SalaryCompatibility
|
||||
view.dto.SalaryCompatibility = &value
|
||||
}
|
||||
if input.PublishedFields.Contains(CardFieldProjects) {
|
||||
view.dto.Projects = candidateViewProjects(input.Profile)
|
||||
}
|
||||
return view, nil
|
||||
}
|
||||
|
||||
@@ -366,9 +409,38 @@ func cloneAnonymousCandidateViewDTO(dto AnonymousCandidateViewDTO) AnonymousCand
|
||||
dto.ExperienceBand = clonePointer(dto.ExperienceBand)
|
||||
dto.WorkFormats = slices.Clone(dto.WorkFormats)
|
||||
dto.SalaryCompatibility = clonePointer(dto.SalaryCompatibility)
|
||||
if dto.Projects != nil {
|
||||
projects := make([]CandidateViewProject, len(dto.Projects))
|
||||
for index, project := range dto.Projects {
|
||||
project.Description = clonePointer(project.Description)
|
||||
project.Stack = slices.Clone(project.Stack)
|
||||
projects[index] = project
|
||||
}
|
||||
dto.Projects = projects
|
||||
}
|
||||
return dto
|
||||
}
|
||||
|
||||
// candidateViewProjects lists the confirmed projects in profile order, so
|
||||
// the position of a project in the card equals its position in the profile.
|
||||
func candidateViewProjects(profile CandidateViewProfile) []CandidateViewProject {
|
||||
var projects []CandidateViewProject
|
||||
for _, claim := range profile.projects {
|
||||
if claim.status != ProfileClaimConfirmed {
|
||||
continue
|
||||
}
|
||||
stack := claim.value.StackTags()
|
||||
if stack == nil {
|
||||
stack = []string{}
|
||||
}
|
||||
projects = append(projects, CandidateViewProject{
|
||||
Title: claim.value.Title, Description: optionalString(claim.value.Description),
|
||||
Stack: stack, RepositoryVerified: claim.verified,
|
||||
})
|
||||
}
|
||||
return projects
|
||||
}
|
||||
|
||||
func validCandidateViewPseudonym(pseudonym string) bool {
|
||||
if !strings.HasPrefix(pseudonym, candidateViewPseudonymPrefix) {
|
||||
return false
|
||||
|
||||
Reference in new issue
Block a user