ATS scoring engine + backend/frontend integration #8

Merged
talha.ahmed merged 1 commits from Talha into main 2026-08-21 12:25:56 +00:00

What this brings into main

  • Bulk ATS scoring engine (bulk-ats app): scores resume PDFs against a job description with OpenAI structured outputs - bounded concurrency, schema-validated results, score-sorted leaderboard.
  • Backend integration: new candidates table plus scoring routes - POST /candidate/score (multipart CV upload), POST /candidate/score_inbox (score decoded inbox attachments), GET /candidate/scored/fetch (persisted leaderboard), GET /candidate/fetch_by_id, GET /job/fetch.
  • Frontend integration: CV Import now really uploads and scores PDFs; Candidates shows the persisted scored leaderboard with filters and the ATS-match breakdown; profile modal shows real scoring data.

Merge with the talent-pool work (PRs #6/#7)

Both candidate features coexist:

  • GET /candidate/fetch stays the paginated inbox-profile listing from main (CandidateView).
  • The scoring leaderboard moved to GET /candidate/scored/fetch; the frontend points there.
  • TalentPool keeps main's profile card grid; Candidates keeps the scored table; the AtsMatch modal is shared between both screens.

Note for reviewers

backend/inbox/decoded_attachments/Mehdi Raza Content Writing Samples 001.docx (a real candidate CV) was committed on main and rides along in this diff - personal data probably should not live in source control.

?? Generated with Claude Code

## What this brings into main - **Bulk ATS scoring engine** (`bulk-ats` app): scores resume PDFs against a job description with OpenAI structured outputs - bounded concurrency, schema-validated results, score-sorted leaderboard. - **Backend integration**: new `candidates` table plus scoring routes - `POST /candidate/score` (multipart CV upload), `POST /candidate/score_inbox` (score decoded inbox attachments), `GET /candidate/scored/fetch` (persisted leaderboard), `GET /candidate/fetch_by_id`, `GET /job/fetch`. - **Frontend integration**: CV Import now really uploads and scores PDFs; Candidates shows the persisted scored leaderboard with filters and the ATS-match breakdown; profile modal shows real scoring data. ## Merge with the talent-pool work (PRs #6/#7) Both candidate features coexist: - `GET /candidate/fetch` stays the paginated inbox-profile listing from main (`CandidateView`). - The scoring leaderboard moved to `GET /candidate/scored/fetch`; the frontend points there. - TalentPool keeps main's profile card grid; Candidates keeps the scored table; the `AtsMatch` modal is shared between both screens. ## Note for reviewers `backend/inbox/decoded_attachments/Mehdi Raza Content Writing Samples 001.docx` (a real candidate CV) was committed on main and rides along in this diff - personal data probably should not live in source control. ?? Generated with [Claude Code](https://claude.com/claude-code)
talha.ahmed added 5 commits 2026-08-11 11:20:38 +00:00
a68d4bc2f6 Integrate bulk-ats scoring into backend: candidates table + scoring routes
Embeds the tested bulk-ats engine (pip install -e ., app.services.*) rather
than duplicating it. New Candidates table (auto-migrated) persists one row per
CV per job, deduped on (job_id, content_sha256) so re-scores update in place.
CandidateScoring service extracts (pypdf off-loop), despaces, scores with
bounded concurrency + cache priming via llm_setup's shared client, and
isolates per-file failures as failed rows. Routes: /candidate/score (uploads),
/candidate/score_inbox (decoded attachments), /candidate/fetch,
/candidate/fetch_by_id. Complements the agent inbox-match flow: it routes,
this scores.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
9ffa1ef673 Phase 2: wire frontend candidate screens to the real scoring API
Backend: GET /job/fetch (active job posts, job-board OR candidate viewers) and
/candidate/fetch now works unscoped for the cross-job pool. Frontend: apiClient
gains FormData support; new api/candidates.js with a shared snake->camel view
mapper; CvImport is a real upload->score flow (job selector, PDF multipart to
/candidate/score, per-file results, no more simulation); TalentPool and
Candidates render the persisted pool with job/skill/source/ATS filters; the ATS
modal shows the real critique and matched/missing skills; CandidateProfile
keeps only tabs the backend can back. Screens hide affordances with no backing
column instead of rendering placeholders (Inbox precedent).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
05aa6b4ada Rewrite README as the complete project document
Covers the whole system as it now runs: architecture (agent routing vs ATS
scoring), repo layout, clean-machine quick start incl. the fresh-DB enum
workaround, the backend scoring API surface with behavior guarantees, the
engine internals summary, QA status (28/28 audit, 23/23 integration), data
handling, and the honest gap/roadmap table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
927cb37672 Merge origin/main (talent pool API + user-candidate linking) into Talha
Both sides had rewritten the candidate surface, so the merge keeps the two
features side by side instead of picking one:

- GET /candidate/fetch stays main's paginated inbox-profile listing
  (CandidateView); the scoring leaderboard moved to GET /candidate/scored/fetch
  and the frontend listCandidates() now points there.
- backend candidate views/serializers keep both CandidateScoring and
  CandidateView, serialize_candidate and serialize_candidate_profile.
- Candidates.jsx stays the scored table (Talha); TalentPool.jsx takes main's
  profile card grid; AtsMatch is exported from Candidates for TalentPool's
  modal and tolerates a missing jobTitle.
- CandidateProfile hides the Scored/Failed badge for rows that were never
  scored (talent-pool profiles).
- queryKeys.js: dropped a duplicated candidates block the auto-merge produced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-11 14:11:12 +00:00
eb95d7a2c0 Merge origin/main (PR #9: interviews, notes, activity, feedback + job matching) into Talha
Union resolution, same policy as the previous merge — both feature sets kept:

- app.py: scoring routes kept; main's richer GET /job/fetch (search/top/skip/ids)
  adopted, with the dual JOB_BOARD_VIEW-or-CANDIDATES_VIEW permission restored so
  recruiters with only candidate rights keep the CV Import job picker.
- candidate/models.py: Candidates (scoring) coexists with main's new Interviews,
  Notes, Activity, Feedback models.
- candidate/serializers.py: serialize_candidate kept alongside main's
  detail-mode serialize_candidate_profile.
- CandidateProfile.jsx: main's rich tabbed profile (interviews/notes/feedback/
  activity) is now THE CandidateProfile, used by TalentPool; the scored-CV modal
  moved to ScoredCandidateProfile.jsx, used by Candidates.jsx. The two payload
  shapes share almost no fields, hence two components.

Backend imports verified; frontend builds clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-11 14:21:52 +00:00
7c593d32ce Surface real ATS scores in the talent-pool profile
Main stubbed ai_score/recommendation as None in the candidate-profile payload;
fill them from the scoring engine's candidates table, joined by inbox message
(one batched query for the list, assigned-job-preferred for the detail). The
detail payload also gains matched/missing keywords, the critique, and which job
the score was against.

Frontend: TalentPool cards and the profile hero prefer the real score over the
seed placeholder, and the profile grows a Score-with-ATS button (shown when the
candidate has an assigned job and an inbox message) that runs the existing
score_inbox pipeline and repaints via the detail refetch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-11 15:02:25 +00:00
da61fe2a3a Auto-score inbox CVs against matched jobs - no manual upload needed
The decoded attachment is already the CV and the job post is already the JD, so
scoring now fires from the data we have:

- After the agent matches an inbox message, score_message_against_job runs
  inline in the match task - against the assigned job if one is set, else the
  top suggested job. Failures log and never fail the match.
- When a recruiter assigns a job post, the new inbox.score_message task is
  queued in the background so the request never waits on OpenAI.

Idempotent by (message, job): an already-completed score is never paid for
twice. Rows are attributed to the job post owner since background tasks have
no request user. CV Import and the profile Score-with-ATS button remain as
manual fallbacks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-12 11:08:28 +00:00
8ada794b29 Merge origin/main (PR #10: manual candidate upload) into Talha
Conflict resolutions:
- backend/job/app.py: dropped duplicate pydantic import (already present below)
- backend/job/candidate/views.py: union of both sides — kept Talha's
  _recommendation/_scores_by_message helpers alongside main's manual-upload
  create_candidate, merged import lists and module-level config
- frontend/src/lib/apiClient.js: both sides made the same FormData fix;
  kept main's version that reuses the shared multipart const
- frontend/src/screens/Candidates.jsx: kept Talha's live-data screen and
  ported main's AddCandidate modal onto it — server POST via
  candidatesApi.createManual with live job posts, seed-shaped buildRow
  replaced by a candidates query invalidation; seed-only BulkAssign dropped

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-12 15:44:12 +00:00
5c0eaef86d ATS scores land on inbox tables + ats_results history; manual SQL auto-applies on boot
- inbox_messages.ats_score/ats_band written on every completed inbox score;
  inbox.ats_id always points at the current ats_results row
- ats_results now holds the supersede-chained history for BOTH inbox and
  upload scores (new candidate_id link, inbox_id nullable for uploads)
- migrations/manual/*.sql apply automatically at startup, tracked once per
  database in manual_migrations - developers just pull and boot
- 002_backfill_inbox_ats.sql backfills pre-existing scores
- Add Candidate modal: Matching-style role picker above the CV dropzone,
  and the CV is scored via /candidate/score after creation

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-13 11:26:47 +00:00
b3483d9a6e Tasks domain: real backend + live screen with DB users/roles as assignees
- New backend/tasks/ package (offer/ house style): tasks table
  (title/status/priority/due_date/assignee_id -> users.id, optional
  inbox_id/job_post_id links, soft delete), routes /tasks/fetch|create|
  update|delete guarded by new tasks.* permission tags
- Assignees validated against users+roles: must exist, not deleted, not
  candidate-role; omitted assignee defaults to the caller; responses carry
  assignee_name/assignee_role from one batched join
- TASKS permission module (104 -> 112 tags); manual/004_tasks_rbac.sql
  seeds the tags + tasks_management bundle onto 6 staff roles (auto-applies
  at startup)
- Tasks.jsx cut over from seed to live: real create/complete/reopen with
  optimistic flip, two-click delete in the detail modal, assignee picker
  listing real users with roles; live sidebar badge (open-task total);
  route now requires tasks.view

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-13 12:54:18 +00:00
6eefaa2fad Tasks: recruiter-only assignees, role-gated creation, assignees API
- Assignees restricted to recruiter-role users (role id resolved from the
  roles table per request, not hardcoded); server 422s any other role on
  create and update
- New GET /tasks/assignees/fetch: active recruiter users for the picker,
  separate from /users/fetch so assigning never needs rbac_users.view
- Creation gated to system_administrator / hr_administrator / recruiter:
  allowed role ids searched from the DB and compared to the callers
  role_id, on top of the tasks.create permission tag
- manual/005_tasks_rbac_restrict.sql: permission DB follows suit -
  hiring_manager / department_head / ceo swap tasks_management for a
  view-only tasks_viewer bundle (idempotent, auto-applies at boot)
- UI: assignee dropdown lists recruiters from the new endpoint with
  required-field validation; recruiters get an assign-to-me default; the
  New Task button honours the creator roles

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-17 14:45:48 +00:00
talha.ahmed added 1 commit 2026-08-19 13:51:50 +00:00
Deploy to S3 / deploy (push) Successful in 33s Details
84f2918e43
AI field assist on job forms + channel-free internal job creation
- New POST /job/assist-field (job_board.create OR jobs.edit): per-field
  AI fix/suggest via backend/job_assist package on the shared llm_call.
  Suggest is gated on title + experience anchors; decisive typo repair;
  provider failures return a generic 503.
- AiFieldAssist component: sparkle button per field with fix/suggest,
  loading, preview-before-apply, abort on close; wired into JobForm and
  EditJobForm with per-field suggest hints.
- Create Job no longer requires a Buffer channel: without channel_id or
  platform the backend saves an internal-only requisition (platform
  internal) and never calls Buffer; publishing stays on the Job Board.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-19 14:56:17 +00:00
878d1e3776 Add AI sparkles icon to the Create Job button
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-19 15:01:56 +00:00
9eb1a5f311 Rename assist preview button from Redo to Regenerate
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-19 15:10:24 +00:00
202d05c4f9 Real Excel export for the Jobs list
- GET /jobs/export (jobs.export): styled .xlsx via openpyxl — branded
  banner, dark-green frozen header with auto-filter, zebra rows, color-
  coded status, bulleted requirements/nice-to-have, date formatting.
  Honors the same filters as /jobs/fetch.
- Export button on the Jobs screen now downloads the file through the
  authenticated downloadFile helper, carrying the active UI filters,
  with an Exporting... busy state (was a fake success toast).
- openpyxl pinned in backend requirements.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-20 17:27:13 +00:00
e1bd8526f3 Talent tab: LinkedIn sourcing per job via Apify
New backend/talent/ module (runs + profiles tables, RBAC talent.* seed,
frontend-polled run lifecycle) and frontend Talent screen: job + location
pickers, paid-search confirm, big loader, ranked profile cards with match
ring, profile detail modal, show-10-then-more, next-page re-search.

Sourcing quality: current-title facet + skills-only keyword query,
experience-range facet, thin-result broadening ladder, Utopia Brands/Deals
current employees excluded actor-side and server-side, graded 0-100
relevance score (title phrase over keyword stuffing).

Also narrows the overbroad **_**_**.py gitignore rule to alembic versions;
it was silently swallowing app/tests __init__.py files, the engine smoke
script, and the new talent plugin tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed added 1 commit 2026-08-21 12:24:29 +00:00
600d438af3 Analytics: report library, NL ask, TTH baseline, source spend
Builds the four remaining analytics gaps from the architecture plan:

- Report library (REQ-ANL-03): new backend/reports module - saved reports
  as parameterisations of the governed analytics queries (never free-form
  SQL), rolling window_days filters, recorded runs, CSV export via
  Content-Disposition. Reports screen gains the library card with
  create/run/export/delete plus a results modal.
- Natural-language analytics (REQ-ANL-05, ADR-0010): POST /analytics/ask
  maps a question onto one whitelisted intent, runs the same governed
  query the dashboard uses, then narrates the numbers. Ask Analytics card
  on the Analytics screen; LLM outages 503 without touching the charts.
- Time-to-hire baseline (REQ-ANL-08): KPIs surface tth_baseline_* from
  org setting analytics.tth_baseline ({days,source}); not hardcoded
  per OPEN-12. analytics added to org-settings categories. Reports TTH
  card shows the delta when set.
- Source spend (REQ-ANL-09 cost side): hiring costs can be tagged with a
  source channel; source performance returns tagged spend and
  cost-per-application, including spend-only rows for channels with zero
  applications (wasted spend must stay visible). Log-cost modal and
  Source Performance table on Reports; untagged spend stays
  cost-per-hire only.

Verified live: migration autogenerated and applied (saved_reports,
report_runs, hiring_costs.source_channel_id), 50 backend tests, vite
build + smoke/token/theme suites, and a headless-browser drive of both
screens end to end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
talha.ahmed merged commit 0009c40ac1 into main 2026-08-21 12:25:56 +00:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: utopia-ai/HR-ATS-Portal#8
There is no content yet.