CASE STUDY 02 · TRANSACTIONS & AUDIT

Placement Operations Eligibility + Funnel

Placement Management System

Derive eligibility from current rules, record one application per drive, preserve stage history and produce transparent recruitment reports without spreadsheet contradictions.

01 · PROBLEM & DECISION BOUNDARY

Track opportunities without turning predictions into facts

A placement cell coordinates students, companies, drives, applications and selection stages. The database must answer: Who is eligible now? Who applied? How many reached each stage? Who was selected? It should not label a student “employable” or infer merit from one company’s outcome.

Master facts

Student academic status and company criteria.

Event facts

Application creation and stage transitions.

Reports

Eligibility lists, drive funnels and auditable histories.

Fair-use boundary: eligibility applies published drive rules. Sensitive attributes must not be added to screening queries merely because they exist elsewhere.
02 · BUSINESS RULES

Separate policy from event history

RuleImplementationReason
CGPA is 0–10; backlogs cannot be negativeCHECKReject impossible states
One company may conduct many drivesdrive.company_id FKDo not duplicate company policy
One student applies once per driveUNIQUE(drive_id, student_id)Prevent double counts
Stage belongs to an allowed lifecycle vocabularyCHECK(stage IN …)Prevent spelling variants
Every stage change remains explainableAudit trigger/event tablePreserve accountability

The demonstration stores company minimum CGPA and backlog allowance. Real criteria may be drive-specific, include graduating batch and eligible branches, and change over time. In that case, snapshot criteria on the drive so later audits reproduce the rule that actually applied.

03 · NORMALIZED MODEL

Application is the bridge between student and drive

Company
1 → N
Drive
1 → N
Application
N ← 1
Student

stage_event forms a one-to-many history beneath application. Current stage remains on application for fast operational views; events preserve transitions. This deliberate duplication needs one write path—a trigger in the teaching script—so current and historical state do not diverge.

Why eligibility is derived

Storing an “eligible” Boolean becomes stale when CGPA, backlog count or criteria change. The eligibility query compares current student facts with current company rules. For legal/audit reproduction, store the criteria snapshot and eligibility decision used when invitations were issued.

04 · TRANSACTIONAL WORKFLOW

Stage changes are events, not silent overwrites

  1. Confirm the application exists and its current stage permits the transition.
  2. Begin a transaction.
  3. Update exactly the expected row, optionally using WHERE stage='Technical' as optimistic protection.
  4. The trigger appends the new state to stage_event.
  5. Verify one row changed, then commit; otherwise roll back.

The sample changes Technical to HR only when the current value is still Technical. A production workflow should use a transition table or service rule to reject impossible jumps such as Rejected → Selected without authorized correction.

Concurrency insight: “read stage, then update later” can lose another coordinator’s change. Put the expected old value or a version number in the update predicate.
05 · ELIGIBILITY & FUNNEL REPORTS

Conditional aggregation converts events into counts

The eligibility report cross joins students and companies, then filters pairs meeting both criteria. The drive funnel groups applications at drive grain. Expressions such as SUM(stage='Selected') count rows satisfying a condition in SQLite.

MeasureQuestionCaution
ApplicantsHow many unique applications?Enforce uniqueness first
Reached technicalHow many progressed to/through technical?Current stage assumes ordered lifecycle
SelectedHow many final selections?Define withdrawn offers separately
Conversionselected/applicants × 100Avoid division by zero

If candidates can skip stages or re-enter a stage, calculate funnel metrics from stage events with distinct application IDs rather than inferring history from current stage.

06 · COMPLETE IMPLEMENTATION

Executable SQLite schema, trigger and reports

programs/placement-management.sql
Loading source…

Run with sqlite3 :memory: < placement-management.sql. The deterministic seed data demonstrates multiple companies, eligibility combinations, a funnel and an audited stage update.

07 · INTERACTIVE STAGE TRACE

Follow one safe status change

  1. Read expected state.
  2. Open transaction.
  3. Use guarded update.
  4. Validate new value.
  5. Write audit event.
  6. Commit both facts.
  7. Verify history.
Current state

Press Next to begin.

08 · TEST MATRIX

Test constraints, workflow and reports

Eligibility boundaries
A student exactly at minimum CGPA/backlog limits must qualify; one outside either limit must not.
Duplicate application
Insert the same student-drive pair twice and expect a uniqueness failure.
Invalid stage
Attempt stage “Interview2”; expect the CHECK constraint to reject it.
Audit completeness
Perform two valid updates and verify two ordered stage events appear.
Guarded concurrency
Update using a stale expected stage; confirm zero rows changed and no audit event was created.
Funnel reconciliation
For every drive ensure selected ≤ reached technical ≤ cleared aptitude ≤ applicants under the ordered-stage assumption.
09 · PERFORMANCE, PRIVACY & GOVERNANCE

Placement data deserves least-privilege access

The drive-stage index supports funnel filtering/grouping; the eligibility index may help range filtering, but low-cardinality backlog values alone are weak indexes. Verify real workloads with query plans. Separate student self-service, recruiter access and coordinator privileges. Encrypt sensitive data, avoid exposing personal contact details in broad exports, log corrections and set retention periods.

Reports should show definitions and timestamps. A “selected” count without drive scope, offer status or as-of date can mislead. Keep eligibility rules explainable and provide a correction route for inaccurate CGPA/backlog data.

10 · KNOWLEDGE CHECK & EXTENSIONS

Reason about derived state

What is the safest current eligibility source?

What prevents funnel double counting at entry?

Extensions

  1. Add branches, graduating batches and drive-specific eligibility criteria.
  2. Model offers, joining status and multiple-offer policy separately.
  3. Implement allowed stage transitions and authorized correction reasons.
  4. Create branch-wise conversion views without exposing student-level data.
  5. Use window functions to rank packages within a graduating batch.
11 · INTERVIEW PREPARATION

Explain operational correctness

Why keep a stage-event table?

Current state answers “where now”; events answer how and when it changed, supporting audits and richer funnel analysis.

Trigger advantage and risk?

It applies across applications, but hidden behavior can surprise developers. Document, test and keep triggers small.

Why a transaction?

The business action must not leave current stage changed without the corresponding audit event.

What is optimistic concurrency?

An update includes the previously observed value/version. Zero affected rows signals another change instead of overwriting it.

How do you prevent biased reporting?

Use declared definitions and populations, avoid protected features in screening, audit data quality and publish limitations.

12 · KEY TAKEAWAY

Operational data must remain explainable

The strongest design derives eligibility, makes application grain unique, protects stage updates transactionally and preserves history. Reports become trustworthy because their definitions and data lineage are visible—not because the dashboard looks precise.