PARAM Healthcare

Full Stack take-home

Duty Doctor Roster

Constraint-based monthly roster generator for hospital emergency duty shifts.

Build a monthly duty doctor roster scheduler for a hospital emergency department. Staff names below are fictional — use them exactly as written in your seed data and UI.

1. Shift structure

ShiftTimingEligibilityMin doctors
Morning Shift8:00 AM – 2:00 PMAny doctor1
Day Shift10:00 AM – 6:00 PMAny doctor1
OBGYN Shift10:00 AM – 6:00 PMFemale doctors only1
Afternoon Shift2:00 PM – 8:00 PMAny doctor1
Night Shift8:00 PM – 8:00 AMAny doctor1

Additional rule: Any doctor who remains unassigned after mandatory shift allocation should be assigned to the Day Shift.

2. Doctor master rules

Dr. Meera Kapoor

  • Allowed shifts: All shifts
  • Weekly off: Wednesday
  • Notes: Subject to post-night recovery rule

Dr. Rohan Khanna

  • Allowed shifts: 4 Night shifts/week (Mon–Thu), 1 Morning/week, 1 Afternoon/week
  • Weekly off: Friday
  • Notes: Exempt from post-night recovery rule; consecutive nights allowed

Dr. Aditya Nair

  • Allowed shifts: All shifts
  • Weekly off: Thursday
  • Notes: Subject to post-night recovery rule

Dr. Priya Sharma

  • Allowed shifts: All shifts
  • Weekly off: Tuesday
  • Notes: Subject to post-night recovery rule

Dr. Imran Siddiqui

  • Allowed shifts: Day Shift only; max 2 Night shifts/month
  • Weekly off: Sunday
  • Notes: Subject to post-night recovery rule

Dr. Kavya Menon

  • Allowed shifts: All shifts
  • Weekly off: Saturday
  • Notes: Subject to post-night recovery rule

3. General scheduling rules

  • Generate the roster monthly.
  • A doctor can work only one shift per day.
  • A doctor can work a maximum of six shifts per week.
  • Weekly offs are mandatory and cannot be overridden.
  • Approved leave blocks all shift assignment for that doctor on that date.

3a. Seed leave data (June 2026)

Seed the roster with 4 approved leave days on the dates below. These doctors must be treated as unavailable on their leave date (same as weekly off). Do not assign any shift to them on these days.

DoctorLeave dateISO date
Dr. Meera KapoorFriday, 5 June 20262026-06-05
Dr. Aditya NairFriday, 12 June 20262026-06-12
Dr. Priya SharmaFriday, 19 June 20262026-06-19
Dr. Kavya MenonTuesday, 23 June 20262026-06-23

Your UI should display these leaves on the calendar. Admins may add more leave days later; generation must re-run with updated availability.

4. OBGYN shift rules

Eligible: Dr. Meera Kapoor, Dr. Priya Sharma, Dr. Kavya Menon

Not eligible: Dr. Rohan Khanna, Dr. Aditya Nair, Dr. Imran Siddiqui

Distribute OBGYN duties equally among eligible female doctors.

5. Night shift rules

Dr. Rohan Khanna

  • Must work 4 Night shifts every week (Monday–Thursday only).
  • Must also receive 1 Morning shift and 1 Afternoon shift per week.
  • Not subject to post-night recovery restrictions.

Dr. Imran Siddiqui

  • Maximum 2 Night shifts per month.
  • All remaining duties should be Day Shifts.

Remaining night shifts

Distribute equally among: Dr. Meera Kapoor, Dr. Aditya Nair, Dr. Priya Sharma, Dr. Kavya Menon.

6. Post-night recovery rule

Applies to everyone except Dr. Rohan Khanna. After a Night Shift, the next working day can only be an Afternoon Shift or an off day. Morning, Day, and OBGYN shifts are not allowed the day after a night.

7. Consecutive night shift rule

Consecutive Night shifts are not allowed for any doctor except Dr. Rohan Khanna.

8–9. Workload limits & scheduling priority

Maximum 1 shift per day and 6 shifts per week for every doctor.

Apply constraints in this order:

  1. 1. Gender restrictions
  2. 2. Weekly offs
  3. 3. Approved leave days
  4. 4. One shift per day rule
  5. 5. Maximum 6 shifts per week
  6. 6. Fixed Night shift allocation for Dr. Rohan Khanna
  7. 7. Dr. Imran Siddiqui’s restrictions
  8. 8. Post-night recovery rule
  9. 9. No consecutive Night shifts
  10. 10. Equal Night shift distribution
  11. 11. Equal OBGYN duty distribution
  12. 12. Assign remaining available doctors to the Day Shift

10. Preferred recovery pattern

  • Day 1: Night Shift
  • Day 2: Afternoon Shift or off
  • Day 3: Resume normal eligible duties

11. Operational constraints

Expect difficult scheduling around weekends, female-only OBGYN coverage, and recovery windows — especially Fridays through Sundays.

12–15. Reduced staffing rules

  • If 2 doctors are unavailable → remove OBGYN Shift (keep Morning, Day, Afternoon, Night).
  • If 3 doctors are unavailable → remove OBGYN and Day Shifts (keep Morning, Afternoon, Night).
  • Unavailable = weekly off, leave, recovery block, ineligible shift, weekly limit reached, same-day conflict, or consecutive-night block.
  • When removing shifts, retain in order: Night Shift → Morning Shift → Afternoon Shift → Day Shift → OBGYN Shift.

16. Technical requirements

  • Use Node.js packages only on the backend (npm). No Python microservices or OR-Tools for this take-home.
  • Use raw SQL queries against Supabase/PostgreSQL — no ORM tools (no Prisma, Drizzle, TypeORM, Sequelize, etc.).
  • Do not integrate AI/LLM APIs into the roster app (no OpenAI, Claude, Gemini, etc. at runtime).
  • AI-assisted coding tools (Cursor, Copilot, etc.) are permitted while building — the submitted app must not call AI services.
  • Persist all roster data in Supabase (PostgreSQL). Provide your schema SQL and seed scripts.
  • Generate a real monthly roster stored in the database — not hard-coded JSON or a mock-only UI.
  • Frontend must be editable: admins can manually assign, change, or clear any doctor on any shift for any day.
  • Manual overrides must be saved to Supabase and survive page refresh (set is_manual_override / source=manual).
  • Re-generation must not silently overwrite manual overrides unless the user explicitly chooses to reset that day or month.

Supabase database

Use Supabase as the database. Start from the reference schema (doctors, shift types, monthly rosters, assignments with manual-override flags, and leaves). Run it in your Supabase project and commit the SQL in your repo at supabase/duty-doctor-roster-schema.sql.

Download reference schema (.sql) →

17. What to build

  • Node.js + TypeScript API using raw SQL (no ORM) that generates a valid monthly roster and writes rows to Supabase.
  • Supabase schema + seed data (doctors, shifts, 4 leave days) — extend the reference schema as needed.
  • React UI: month calendar/grid showing the real persisted roster.
  • Per-day, per-shift editing: change doctor, clear slot, or mark shift inactive (reduced staffing).
  • Manual overrides saved immediately to Supabase; show visual indicator for overridden cells.
  • “Generate roster” action for a month; warn before overwriting non-manual assignments.
  • Validation toasts/errors when a manual pick breaks scheduling rules (optional override with note).
  • No AI/LLM runtime integration in the submitted application.
  • README: setup, env vars, algorithm, and how manual overrides interact with re-generation.
  • Deploy (Vercel + Supabase) with a public GitHub repo.

Submission

Apply on the careers page under Full Stack Developer. You will receive a Test ID and 24-hour deadline. Submit your repo and deployment link via the submission form.