You are an expert oncology clinic schedule optimizer. Given the clinic configuration, constraints, and profile list below, assign optimal start_time and end_time to each service row.

## SCHEDULING TIME BLOCK
- Each time slot = 15 minutes (all times must align to 15-min boundaries)
- end_time = start_time + (service_duration × 15 minutes)

## RESOURCE CONSTRAINTS
- Lab Service requires 1 Lab Chair per patient for the ENTIRE duration of the Lab appointment
- Treatment Service requires 1 Treatment Chair per patient for the ENTIRE duration of the Treatment appointment
- Injection Service requires 1 Injection Chair per patient for the ENTIRE duration of the Injection appointment
- If no Injection Chairs are available at the clinic (quantity = 0), Injection Service uses 1 Treatment Chair instead
- At any time slot, the number of patients using a resource CANNOT exceed its available quantity

## STAFF TYPE CONSTRAINTS
- MD Service requires 1 MD for the ENTIRE duration of the MD appointment
- Lab Service requires 1 Lab Tech for the ENTIRE duration of the Lab appointment
- Treatment Service requires 1 RN at the START of treatment (first 15-min slot only)
- Treatment Service requires 0 additional RN for the Patient-in-Chair Duration (middle slots — no dedicated RN needed)
- Treatment Service requires 1 RN at the END of treatment (last 15-min slot only)
- Injection Service requires 1 LPN for the ENTIRE duration of the Injection
- Staff can ONLY work within their defined start_time to end_time
- At treatment start time, there should be at least 1 RN available without a concurrent treatment start

## TIMING CONSTRAINTS
- Treatment must start at or later than Treatment Room Start Time
- Treatment must end at or earlier than Treatment Room End Time
- Lab must start at or later than Lab Start Time
- Lab must end at or earlier than Lab End Time
- No service can start before clinic opens or end after clinic closes
- All times must be in increments of the Scheduling Time Block (15 min)

## CAPACITY CONSTRAINTS
- For each Staff Type: limited number of staff available per time slot (given in config below)
- For each Resource: limited quantity available per time slot (given in config below)
- For each service: defined max number of starts allowed per time slot (e.g., max 2 TTCNP starts per slot)
- DO NOT START rules: defined time windows when a service CANNOT begin (but already-running services continue)

## GLOBAL RULES
- Services within a profile MUST be contiguous — end_time of one service = start_time of the next
- If a profile cannot be fully assigned due to ANY constraint conflict, set start_time="00:00:00" and end_time="00:00:00" for ALL services in that profile

## OPTIMIZATION GOALS (in priority order)
1. MAXIMIZE profile assignments — assign as many profiles as possible
2. Respect ALL constraints strictly — never violate a constraint to fit more profiles
3. Services within a profile MUST be contiguous (zero gaps)
4. Schedule LONGEST profiles first — sort profiles by total duration (sum of all service_duration values) descending, then assign each profile to the earliest available time slot
5. Optimize for higher resource utilization and cost-efficient staffing
6. Minimize idle time between profile starts

## CRITICAL ARITHMETIC RULES
end_time = start_time + (service_duration × 15 minutes)

MANDATORY CALCULATION METHOD — follow these steps for EVERY row:
1. Convert start_time to total minutes from midnight: HH:MM → (HH × 60) + MM
2. Compute duration_minutes = service_duration × 15
3. Compute end_minutes = start_minutes + duration_minutes
4. Convert end_minutes back to HH:MM: HH = end_minutes ÷ 60 (integer), MM = end_minutes mod 60

DURATION REFERENCE TABLE (use this — do NOT calculate in your head):
- duration=1  →  15 min (0h15m)
- duration=2  →  30 min (0h30m)
- duration=4  →  60 min (1h00m)
- duration=8  → 120 min (2h00m)
- duration=10 → 150 min (2h30m)
- duration=12 → 180 min (3h00m)
- duration=14 → 210 min (3h30m) ← NOT 4h! NOT 4h30m!
- duration=16 → 240 min (4h00m)

WORKED EXAMPLES WITH FULL ARITHMETIC:
- start=07:00, duration=1:  (7×60+0)=420 + 15 = 435 → 435÷60=7r15 → 07:15:00
- start=07:30, duration=8:  (7×60+30)=450 + 120 = 570 → 570÷60=9r30 → 09:30:00
- start=07:30, duration=14: (7×60+30)=450 + 210 = 660 → 660÷60=11r0 → 11:00:00
- start=09:30, duration=14: (9×60+30)=570 + 210 = 780 → 780÷60=13r0 → 13:00:00 (NOT 14:00!)
- start=10:00, duration=14: (10×60+0)=600 + 210 = 810 → 810÷60=13r30 → 13:30:00
- start=10:30, duration=14: (10×60+30)=630 + 210 = 840 → 840÷60=14r0 → 14:00:00

COMMON ERROR: duration=14 does NOT mean "add 14 to the hour". It means add 210 MINUTES (3h30m).

FINAL SELF-CHECK: After computing ALL rows, verify EVERY row satisfies:
  (start_hour×60 + start_min) + (duration × 15) = (end_hour×60 + end_min)
If ANY row fails, fix it before outputting.


## CLINIC CONFIGURATION (dynamically loaded from CSV)
### CLINIC TIMING (for Monday)
- Clinic Hours: 07:00:00 - 17:00:00 (no service outside these hours)
- Treatment Room: 07:00:00 - 17:00:00 (TTCNP must start at or after 07:00:00 and end by 17:00:00)
- Lab Hours: 07:00:00 - 17:00:00 (Lab Work service CANNOT start before 07:00:00)
- Each time slot = 15 minutes

HARD RULES:
- Lab Work service_id=15: earliest start = 07:00:00
- TTCNP service_id=3: earliest start = 07:00:00
- MD service_id=16: earliest start = 07:00:00

### RESOURCES (Physical Chairs)
- Lab Chairs: 4 (max 4 patients using this resource simultaneously)
- Treatment Chairs: 21 (max 21 patients using this resource simultaneously)
- Injection Chairs: 10 (max 10 patients using this resource simultaneously)
CONSTRAINT: At any 15-minute time slot, the number of patients using each resource
cannot exceed its quantity. A patient occupies a chair for the ENTIRE duration of their service.

### STAFF AVAILABILITY (for Monday, only Available staff)
- RN (Registered Nurse): 07:30:00-17:00:00, 9 available per slot
- LPN (Injection Nurse): 08:00:00-16:00:00, 1 available per slot
- Lab Tech: 07:00:00-17:00:00, 5 available per slot
- MD (Provider): 07:00:00-17:00:00, 7 available per slot
CONSTRAINT: 
- per_time_slot = how many patients this staff type can handle per 15-min slot
- RN is needed at treatment START (first 15 min) and END (last 15 min) only
- MD sees one patient per slot; per_time_slot = number of MDs available
- Lab Tech handles one patient per slot; per_time_slot = number of Lab Techs
- LPN needed for entire injection duration
- Staff can only work within their start_time to end_time

### SERVICE SEQUENCE (mandatory order within each profile)
Services within a profile MUST be scheduled in this order:
  1. Lab Work (requires: Lab Tech)
  3. MD (requires: MD (Provider))
  4. Treatment (TTCNP) (requires: RN (Registered Nurse))
  5. Injection (requires: LPN (Injection Nurse))
RULE: Each service must finish before the next one starts. Services must be contiguous (zero gaps).

### DO NOT START RULES (for Monday)
No treatment/service can BEGIN during these time windows (but already-running treatments can continue):
- Treatment (TTCNP): DO NOT START between 15:00:00 and 16:15:00

### DO NOT BOOK RULES (for Monday)
No new treatment can START during these time windows (but already-running treatments can continue):
- Treatment (TTCNP): DO NOT START between 12:00:00 and 13:00:00

### MAX TREATMENT STARTS PER SLOT (for Monday)
- Maximum 2 treatments can START in any single 15-minute time slot
- This applies to all slots from 07:15:00 to 16:30:00
- This is a HARD constraint — even if chairs and RNs are available, do not exceed this limit


## PROFILE LIST TO OPTIMIZE (CSV):
schedule_date,clinic_id,name,profile_id,service_id,start_time,service_duration,end_time,service_sequence_id,name
2026-02-16,5990,IMG Clone,1006,15,07:00:00,1,07:15:00,1,Lab Work
2026-02-16,5990,IMG Clone,1006,16,07:00:00,1,07:15:00,2,MD
2026-02-16,5990,IMG Clone,1017,3,07:00:00,8,09:00:00,3,TTCNP
2026-02-16,5990,IMG Clone,1017,16,07:00:00,1,07:15:00,2,MD
2026-02-16,5990,IMG Clone,1025,3,07:00:00,14,10:30:00,3,TTCNP
2026-02-16,5990,IMG Clone,1025,15,07:00:00,1,07:15:00,1,Lab Work
2026-02-16,5990,IMG Clone,1025,16,07:00:00,1,07:15:00,2,MD
2026-02-16,5990,IMG Clone,1001,16,07:00:00,1,07:15:00,2,MD
2026-02-16,5990,IMG Clone,1002,3,07:00:00,8,09:00:00,3,TTCNP

## OUTPUT FORMAT
Wrap your CSV output between the markers ---CSV_START--- and ---CSV_END--- exactly as shown below.
You may include brief reasoning BEFORE the ---CSV_START--- marker if needed, but the CSV data
MUST be between the markers.

---CSV_START---
(CSV rows here, one per line, no header row)
---CSV_END---

Columns: schedule_date,clinic_id,name,profile_id,service_id,start_time,service_duration,end_time,service_sequence_id,name

Rules:
- Keep schedule_date, clinic_id, name(clinic), profile_id, service_id, service_duration, service_sequence_id, name(service) UNCHANGED from input
- Assign NEW start_time and end_time values (HH:MM:SS format)
- end_time = start_time + (service_duration * 15 minutes)
- For UNASSIGNED profiles: set start_time="00:00:00" and end_time="00:00:00"
- Output ALL rows (assigned + unassigned)
- Do NOT add quotes around values
- Do NOT include a header row inside the markers