Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/database/dbgen/evaluations.sql.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/database/dbgen/evaluations.sql.go |
| Original SHA-256 | afd1a2ac271d79087c96f445e6453004aca39eeefa0fc3ea69e1caf73b3630cd |
| Git blob SHA | b4326b7ca5b75cb830541754e1c3688008f1503c |
| Reading-copy SHA-256 | afd1a2ac271d79087c96f445e6453004aca39eeefa0fc3ea69e1caf73b3630cd |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/platform/database/dbgen/evaluations.sql.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/platform/database/dbgen/evaluations.sql.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓171 lines · 6.1 KB
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: evaluations.sql
package dbgen
import (
"context"
"time"
"github.com/google/uuid"
"github.com/shopspring/decimal"
)
const getCandidateEvaluation = `-- name: GetCandidateEvaluation :one
SELECT organization_id, candidate_id, requirement_id, total_score, band, clearance_score, skills_score, certs_score, customer_score, experience_score, location_score, explanation, matched_skills, gap_summary, model_version, evaluated_by, evaluated_at, updated_at, weight_profile_version FROM candidate_evaluations
WHERE candidate_id = $1 AND requirement_id = $2
`
type GetCandidateEvaluationParams struct {
CandidateID uuid.UUID `json:"candidate_id"`
RequirementID uuid.UUID `json:"requirement_id"`
}
func (q *Queries) GetCandidateEvaluation(ctx context.Context, arg GetCandidateEvaluationParams) (CandidateEvaluation, error) {
row := q.db.QueryRow(ctx, getCandidateEvaluation, arg.CandidateID, arg.RequirementID)
var i CandidateEvaluation
err := row.Scan(
&i.OrganizationID,
&i.CandidateID,
&i.RequirementID,
&i.TotalScore,
&i.Band,
&i.ClearanceScore,
&i.SkillsScore,
&i.CertsScore,
&i.CustomerScore,
&i.ExperienceScore,
&i.LocationScore,
&i.Explanation,
&i.MatchedSkills,
&i.GapSummary,
&i.ModelVersion,
&i.EvaluatedBy,
&i.EvaluatedAt,
&i.UpdatedAt,
&i.WeightProfileVersion,
)
return i, err
}
const listEvaluationsForRequirement = `-- name: ListEvaluationsForRequirement :many
SELECT ce.candidate_id, ce.total_score, ce.band, ce.evaluated_at, c.full_name, c.available
FROM candidate_evaluations ce
JOIN candidates c ON c.organization_id = ce.organization_id AND c.id = ce.candidate_id
WHERE ce.requirement_id = $1
ORDER BY ce.total_score DESC, ce.candidate_id
`
type ListEvaluationsForRequirementRow struct {
CandidateID uuid.UUID `json:"candidate_id"`
TotalScore decimal.Decimal `json:"total_score"`
Band string `json:"band"`
EvaluatedAt time.Time `json:"evaluated_at"`
FullName string `json:"full_name"`
Available bool `json:"available"`
}
// The persisted screenMATCH qualifications for one requirement, joined to the candidate name and
// availability, best first. missionMATCH "who can support this mission today" reads this STORED
// artifact rather than rescore the pool. Both tables are RLS scoped, so the join cannot cross tenants.
func (q *Queries) ListEvaluationsForRequirement(ctx context.Context, requirementID uuid.UUID) ([]ListEvaluationsForRequirementRow, error) {
rows, err := q.db.Query(ctx, listEvaluationsForRequirement, requirementID)
if err != nil {
return nil, err
}
defer rows.Close()
items := []ListEvaluationsForRequirementRow{}
for rows.Next() {
var i ListEvaluationsForRequirementRow
if err := rows.Scan(
&i.CandidateID,
&i.TotalScore,
&i.Band,
&i.EvaluatedAt,
&i.FullName,
&i.Available,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const upsertCandidateEvaluation = `-- name: UpsertCandidateEvaluation :exec
INSERT INTO candidate_evaluations (
organization_id, candidate_id, requirement_id,
total_score, band,
clearance_score, skills_score, certs_score, customer_score, experience_score, location_score,
explanation, matched_skills, gap_summary, model_version, evaluated_by, weight_profile_version
) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17)
ON CONFLICT (organization_id, candidate_id, requirement_id) DO UPDATE SET
total_score = EXCLUDED.total_score,
band = EXCLUDED.band,
clearance_score = EXCLUDED.clearance_score,
skills_score = EXCLUDED.skills_score,
certs_score = EXCLUDED.certs_score,
customer_score = EXCLUDED.customer_score,
experience_score = EXCLUDED.experience_score,
location_score = EXCLUDED.location_score,
explanation = EXCLUDED.explanation,
matched_skills = EXCLUDED.matched_skills,
gap_summary = EXCLUDED.gap_summary,
model_version = EXCLUDED.model_version,
evaluated_by = EXCLUDED.evaluated_by,
weight_profile_version = EXCLUDED.weight_profile_version,
updated_at = now()
`
type UpsertCandidateEvaluationParams struct {
OrganizationID uuid.UUID `json:"organization_id"`
CandidateID uuid.UUID `json:"candidate_id"`
RequirementID uuid.UUID `json:"requirement_id"`
TotalScore decimal.Decimal `json:"total_score"`
Band string `json:"band"`
ClearanceScore decimal.Decimal `json:"clearance_score"`
SkillsScore decimal.Decimal `json:"skills_score"`
CertsScore decimal.Decimal `json:"certs_score"`
CustomerScore decimal.Decimal `json:"customer_score"`
ExperienceScore decimal.Decimal `json:"experience_score"`
LocationScore decimal.Decimal `json:"location_score"`
Explanation string `json:"explanation"`
MatchedSkills []byte `json:"matched_skills"`
GapSummary []byte `json:"gap_summary"`
ModelVersion string `json:"model_version"`
EvaluatedBy *uuid.UUID `json:"evaluated_by"`
WeightProfileVersion string `json:"weight_profile_version"`
}
// Upsert the latest screenMATCH qualification for one (candidate, requirement) pair. A fresh screen
// overwrites the prior row so there is exactly one current evaluation per pair, which missionMATCH
// reads instead of recomputing. evaluated_at is preserved as the first time the pair was screened;
// updated_at moves to now() on every rescreen.
func (q *Queries) UpsertCandidateEvaluation(ctx context.Context, arg UpsertCandidateEvaluationParams) error {
_, err := q.db.Exec(ctx, upsertCandidateEvaluation,
arg.OrganizationID,
arg.CandidateID,
arg.RequirementID,
arg.TotalScore,
arg.Band,
arg.ClearanceScore,
arg.SkillsScore,
arg.CertsScore,
arg.CustomerScore,
arg.ExperienceScore,
arg.LocationScore,
arg.Explanation,
arg.MatchedSkills,
arg.GapSummary,
arg.ModelVersion,
arg.EvaluatedBy,
arg.WeightProfileVersion,
)
return err
}