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
@@ -444,9 +444,12 @@ type CandidateProfileInput struct {
|
||||
// the exact periods and indices in Experience.
|
||||
ParallelPeriodAcknowledgements []ProfileParallelPeriodAcknowledgement
|
||||
SoftSkills []ProfileClaimInput[string]
|
||||
Location *ProfileClaimInput[string]
|
||||
Relocation *ProfileClaimInput[bool]
|
||||
SalaryMinimum *ProfileClaimInput[ProfileSalaryMinimum]
|
||||
// Projects replaces the stored projects; nil keeps them, so a client
|
||||
// that does not know the section never deletes it.
|
||||
Projects *[]ProfileClaimInput[ProfileProject]
|
||||
Location *ProfileClaimInput[string]
|
||||
Relocation *ProfileClaimInput[bool]
|
||||
SalaryMinimum *ProfileClaimInput[ProfileSalaryMinimum]
|
||||
}
|
||||
|
||||
// CandidateProfileContent is the validated content of a profile: every claim
|
||||
@@ -464,6 +467,7 @@ type CandidateProfileContent struct {
|
||||
experience []ProfileClaim[ProfileExperience]
|
||||
parallelPeriodAcknowledgements []ProfileParallelPeriodAcknowledgement
|
||||
softSkills []ProfileClaim[string]
|
||||
projects []ProfileClaim[ProfileProject]
|
||||
location *ProfileClaim[string]
|
||||
relocation *ProfileClaim[bool]
|
||||
salaryMinimum *ProfileClaim[ProfileSalaryMinimum]
|
||||
@@ -562,6 +566,12 @@ func (content CandidateProfileContent) SoftSkills() []ProfileClaim[string] {
|
||||
return slices.Clone(content.softSkills)
|
||||
}
|
||||
|
||||
// Projects returns a copy of the projects in the order the candidate gave
|
||||
// them.
|
||||
func (content CandidateProfileContent) Projects() []ProfileClaim[ProfileProject] {
|
||||
return slices.Clone(content.projects)
|
||||
}
|
||||
|
||||
// Equal reports whether both contents hold the same claims with the same
|
||||
// provenance, which tells a change from a body that changes nothing.
|
||||
func (content CandidateProfileContent) Equal(other CandidateProfileContent) bool {
|
||||
@@ -576,7 +586,8 @@ func (content CandidateProfileContent) Equal(other CandidateProfileContent) bool
|
||||
slices.EqualFunc(content.roles, other.roles, claimsEqual) &&
|
||||
slices.EqualFunc(content.experience, other.experience, claimsEqual) &&
|
||||
slices.Equal(content.parallelPeriodAcknowledgements, other.parallelPeriodAcknowledgements) &&
|
||||
slices.EqualFunc(content.softSkills, other.softSkills, claimsEqual)
|
||||
slices.EqualFunc(content.softSkills, other.softSkills, claimsEqual) &&
|
||||
slices.EqualFunc(content.projects, other.projects, claimsEqual)
|
||||
}
|
||||
|
||||
func (CandidateProfileContent) String() string { return redactedProfile }
|
||||
@@ -790,6 +801,7 @@ type profileRules struct {
|
||||
softSkills claimRules[string]
|
||||
roles claimRules[ProfileRole]
|
||||
experience claimRules[ProfileExperience]
|
||||
projects claimRules[ProfileProject]
|
||||
}
|
||||
|
||||
func newProfileRules(now time.Time) profileRules {
|
||||
@@ -815,6 +827,7 @@ func newProfileRules(now time.Time) profileRules {
|
||||
validate: roleRules, key: func(role ProfileRole) string { return string(role.Specialization) }, keyPointer: "/specialization",
|
||||
},
|
||||
experience: claimRules[ProfileExperience]{validate: experienceRules(now)},
|
||||
projects: claimRules[ProfileProject]{validate: projectRules, key: projectKey, keyPointer: "/repository_url"},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1028,6 +1041,14 @@ func ResolveCandidateProfileContent(stored CandidateProfileContent, input Candid
|
||||
content.softSkills, err = resolveItems(rules.softSkills, location, "/soft_skills", input.SoftSkills, stored.softSkills, maxProfileSoftSkills, at)
|
||||
return err
|
||||
},
|
||||
func() (err error) {
|
||||
if input.Projects == nil {
|
||||
content.projects = slices.Clone(stored.projects)
|
||||
return nil
|
||||
}
|
||||
content.projects, err = resolveItems(rules.projects, location, "/projects", *input.Projects, stored.projects, maxProfileProjects, at)
|
||||
return err
|
||||
},
|
||||
func() (err error) {
|
||||
content.location, err = resolveOptional(rules.location, location, "/terms/location", input.Location, stored.location, at)
|
||||
return err
|
||||
@@ -1188,6 +1209,7 @@ const (
|
||||
profileKindLocation = "terms_location"
|
||||
profileKindRelocation = "terms_relocation"
|
||||
profileKindSalaryMinimum = "terms_salary_minimum"
|
||||
profileKindProject = "project"
|
||||
)
|
||||
|
||||
// StoredProfileClaim is a claim as the claims table holds it: the kind, the
|
||||
@@ -1302,6 +1324,7 @@ func (content CandidateProfileContent) StoredClaims() ([]StoredProfileClaim, err
|
||||
entries = appendList(entries, profileKindRole, content.roles, roleStoredValue)
|
||||
entries = appendList(entries, profileKindExperience, content.experience, experienceStoredValue)
|
||||
entries = appendList(entries, profileKindSoftSkill, content.softSkills, plainValue[string])
|
||||
entries = appendList(entries, profileKindProject, content.projects, projectStoredValue)
|
||||
|
||||
rows := make([]StoredProfileClaim, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
@@ -1394,6 +1417,8 @@ func restoreCandidateProfileClaim(
|
||||
return restoreItem(&content.roles, rules.roles, row, status, source)
|
||||
case profileKindExperience:
|
||||
return restoreItem(&content.experience, rules.experience, row, status, source)
|
||||
case profileKindProject:
|
||||
return restoreItem(&content.projects, rules.projects, row, status, source)
|
||||
default:
|
||||
return errors.New("kind is unknown")
|
||||
}
|
||||
@@ -1443,6 +1468,15 @@ func decodeStoredValue[V comparable](row StoredProfileClaim) (V, error) {
|
||||
EmployerName: stringOrEmpty(stored.EmployerName), Specialization: SpecializationCode(stored.Specialization),
|
||||
StartedOn: stored.StartedOn, EndedOn: stringOrEmpty(stored.EndedOn), Summary: stringOrEmpty(stored.Summary),
|
||||
}
|
||||
case *ProfileProject:
|
||||
var stored storedProjectValue
|
||||
if err := decodeStrictJSON(row.Value, &stored); err != nil {
|
||||
return value, err
|
||||
}
|
||||
if stored.Stack == nil {
|
||||
return value, errors.New("value has an unexpected shape")
|
||||
}
|
||||
*target = NewProfileProject(stored.Title, stringOrEmpty(stored.Description), stored.Stack, stringOrEmpty(stored.RepositoryURL))
|
||||
case *ProfileSalaryMinimum:
|
||||
var stored storedSalaryValue
|
||||
if err := decodeStrictJSON(row.Value, &stored); err != nil {
|
||||
|
||||
Reference in new issue
Block a user