Phase 3: ILP Generator

Overview

Duration: ~2 weeks (60-80 hours) Goal: Residents can view enhanced personal dashboard with trajectory charts and AI summaries, and download a pre-populated ILP Word document. Demo: Resident views trajectory, sees comment summaries, clicks button, downloads Word doc with their data pre-filled.

Prerequisites: Phase 2 complete (RBAC working, resident dashboard exists)


Timeline

Week 6                              Week 7
├───────────────────────────────────┼───────────────────────────────────┤
│ Day 1-2    │ Day 3-4   │ Day 5   │ Day 1-2    │ Day 3-4   │ Day 5    │
│ Trajectory │ AI        │ ILP     │ Word Doc   │ Pre-pop   │ Testing  │
│ Charts     │ Comments  │ Schema  │ Generator  │ + Polish  │ + Demo   │
├────────────┼───────────┼─────────┼────────────┼───────────┼──────────┤
│    12h     │    12h    │   8h    │    12h     │    8h     │   8h     │
└────────────┴───────────┴─────────┴────────────┴───────────┴──────────┘

                                                         DEMO 3
                                                     (FINAL DEMO)

User Stories

IDStoryAcceptance Criteria
US-3.1As a resident, I can view my competency trajectory over timeLine chart showing scores over evaluation dates
US-3.2As a resident, I can see how I compare to expected levels for my PGYVisual indicator of expected vs actual
US-3.3As a resident, I can see AI-generated summaries of feedback commentsStrengths and areas for growth sections
US-3.4As a resident, I can download a Word doc ILP pre-filled with my dataButton click → .docx download
US-3.5As a resident, I see reflection prompts appropriate to my training levelPGY-specific prompts in ILP template

Epic 3.1: Personal Dashboard Enhancements (AIM 1 - Full)

Estimated Time: 28 hours

Task IDTaskDescriptionHoursDependencies
3.1.1Trajectory Data APIGET /api/me/trajectory returns time-series data4hPhase 2
3.1.2Trajectory VisualizationLine chart showing scores over time (Chart.js or similar)8h3.1.1
3.1.3Expected Level DataDefine expected scores by PGY level per form4hNone
3.1.4Expected Level ComparisonVisual overlay showing expected vs actual4h3.1.2, 3.1.3
3.1.5AI Comments AdaptationAdapt existing AI system for OB-GYN data format6hPhase 1
3.1.6Comment Summaries ViewDisplay AI summaries (strengths, growth areas)4h3.1.5

Trajectory Visualization Wireframe

┌─────────────────────────────────────────────────────────────────┐
│  My Progress - Milestones                                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Score                                                          │
│    5 ┤                                    ╭──● Current          │
│      │                              ╭────╯                      │
│    4 ┤                        ╭────╯                            │
│      │                  ╭────╯      - - - Expected (PGY-3)      │
│    3 ┤            ╭────╯                                        │
│      │      ╭────╯                                              │
│    2 ┤╭────╯                                                    │
│      │                                                          │
│    1 ┼──────┬──────┬──────┬──────┬──────┬──────┬──────┬────►   │
│      │ Jul  │ Aug  │ Sep  │ Oct  │ Nov  │ Dec  │ Jan  │ Time   │
│      │ '24  │ '24  │ '24  │ '24  │ '24  │ '24  │ '25  │        │
└─────────────────────────────────────────────────────────────────┘
│  ● Your average score    - - - Expected for PGY-3              │
└─────────────────────────────────────────────────────────────────┘

AI Comment Summary Display

┌─────────────────────────────────────────────────────────────────┐
│  Feedback Summary (based on 47 evaluations)                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ✓ STRENGTHS                                                    │
│  ───────────                                                    │
│  • Strong clinical knowledge and patient rapport                │
│  • Consistently prepared and punctual                           │
│  • Effective communication with nursing staff                   │
│                                                                 │
│  ↗ AREAS FOR GROWTH                                             │
│  ──────────────────                                             │
│  • Continue developing surgical autonomy                        │
│  • Work on efficiency in high-volume clinic settings            │
│                                                                 │
│  📊 Based on comments from Jul 2024 - Jan 2025                  │
└─────────────────────────────────────────────────────────────────┘

Epic 3.2: ILP Template System (AIM 2)

Estimated Time: 32 hours

Task IDTaskDescriptionHoursDependencies
3.2.1ILP Schema DesignDefine template sections based on OB-GYN requirements4hNone
3.2.2Reflection Prompts TableCreate DB table for PGY-specific prompts2hNone
3.2.3Seed PromptsLoad prompts from research team2h3.2.2
3.2.4Data Pre-population ServiceGather all learner data for ILP6hPhase 2, 3.1.6
3.2.5Word Doc Generatorpython-docx template and generation logic10h3.2.1
3.2.6ILP Download EndpointGET /api/me/ilp/download returns .docx4h3.2.4, 3.2.5
3.2.7Download Button UIAdd button to resident dashboard2h3.2.6
3.2.8Integration TestingEnd-to-end ILP generation test2hAll above

ILP Template Structure

Based on OB-GYN’s existing ILP format (Appendix 1 of proposal):

┌─────────────────────────────────────────────────────────────────┐
│                    INDIVIDUALIZED LEARNING PLAN                 │
│                         [Resident Name]                         │
│                       Date: [Generated Date]                    │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  CLINICAL                                                       │
│  ────────                                                       │
│  Milestone Summary: [Auto-populated table of recent scores]     │
│  Procedure Summary: [Auto-populated procedure counts/scores]    │
│                                                                 │
│  Feedback Highlights:                                           │
│  • [AI-generated strength 1]                                    │
│  • [AI-generated strength 2]                                    │
│  • [AI-generated growth area 1]                                 │
│                                                                 │
│  ☐ Case Log Reviewed                                            │
│  ☐ MedHub Reports Reviewed                                      │
│                                                                 │
│  QUALITY IMPROVEMENT                                            │
│  ───────────────────                                            │
│  IHI Module: ☐ Completed  ☐ Not Completed                       │
│  QI Project: ________________________________                   │
│                                                                 │
│  RESEARCH                                                       │
│  ────────                                                       │
│  1. _______________________________________________             │
│  2. _______________________________________________             │
│                                                                 │
│  TEACHING                                                       │
│  ────────                                                       │
│  Medical Student Evaluations: [Auto-populated if available]     │
│                                                                 │
│  EXAMINATIONS                                                   │
│  ────────────                                                   │
│  CREOG Score: [Auto-populated if available, else blank]         │
│  Step 3: ☐ Completed  ☐ Not Completed                           │
│                                                                 │
│  GOALS                                                          │
│  ─────                                                          │
│  [Reflection prompt based on PGY level]                         │
│                                                                 │
│  Professional:                                                  │
│  1. _______________________________________________             │
│  2. _______________________________________________             │
│                                                                 │
│  Clinical/Skills:                                               │
│  1. _______________________________________________             │
│  2. _______________________________________________             │
│                                                                 │
│  Personal:                                                      │
│  1. _______________________________________________             │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Reflection Prompts by PGY Level

PGY-1:
  "As a first-year resident, reflect on your transition to residency.
   What clinical skills have you developed? What areas feel most
   challenging? Consider specific patient encounters that shaped your
   learning this period."

PGY-2:
  "As you gain more autonomy, reflect on your growing independence.
   Where do you feel confident making decisions? Where do you still
   seek guidance? What procedures are you ready to lead?"

PGY-3:
  "As a senior resident, reflect on your leadership development.
   How are you teaching junior residents? What subspecialty interests
   are emerging? How are you preparing for independent practice?"

PGY-4:
  "As you approach graduation, reflect on your readiness for practice.
   What are your career goals? What final skills do you want to
   solidify? How will you continue your learning journey?"

Epic 3.3: Future/Budget Items

Task IDTaskDescriptionPriority
3.3.1Configurable PromptsAdmin UI for programs to define own promptsFuture
3.3.2Additional Data FieldsIntegrate exam scores, attendance if availableFuture
3.3.3ILP VersioningSave generated ILPs for historical trackingFuture
3.3.4PDF Export OptionAlternative to Word docFuture
3.3.5Faculty Review WorkflowFaculty can view/comment on resident ILPsFuture

Technical Implementation

python-docx Template Approach

from docx import Document
from docx.shared import Inches, Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH

def generate_ilp(learner_data: dict) -> Document:
    doc = Document()

    # Title
    title = doc.add_heading('Individualized Learning Plan', 0)
    title.alignment = WD_ALIGN_PARAGRAPH.CENTER

    # Resident info
    doc.add_paragraph(f"Resident: {learner_data['name']}")
    doc.add_paragraph(f"PGY Level: {learner_data['pgy_level']}")
    doc.add_paragraph(f"Date: {learner_data['generated_date']}")

    # Clinical section with auto-populated table
    doc.add_heading('Clinical', level=1)
    add_milestone_table(doc, learner_data['milestones'])

    # Feedback highlights
    doc.add_heading('Feedback Highlights', level=2)
    for strength in learner_data['strengths']:
        doc.add_paragraph(f"• {strength}", style='List Bullet')

    # Reflection prompts
    doc.add_heading('Goals', level=1)
    doc.add_paragraph(learner_data['reflection_prompt'])

    # Blank goal fields
    doc.add_paragraph("Professional Goals:")
    doc.add_paragraph("1. _______________________________")
    doc.add_paragraph("2. _______________________________")

    return doc

API Endpoint

@app.route('/api/me/ilp/download')
@require_role('resident', 'program_director', 'super_admin')
def download_ilp():
    user = get_current_user()

    # Get learner mapping
    mapping = get_learner_mapping(user)
    if not mapping:
        return {"error": "No learner mapping found"}, 404

    # Gather all data
    learner_data = gather_ilp_data(mapping)

    # Generate document
    doc = generate_ilp(learner_data)

    # Return as download
    buffer = io.BytesIO()
    doc.save(buffer)
    buffer.seek(0)

    filename = f"ILP_{user.name}_{date.today()}.docx"
    return send_file(
        buffer,
        as_attachment=True,
        download_name=filename,
        mimetype='application/vnd.openxmlformats-officedocument.wordprocessingml.document'
    )

Deliverables

DeliverableDescriptionFormat
Trajectory ChartsTime-series visualization of scoresChart.js component
Expected Level ComparisonVisual showing actual vs expectedUI overlay
AI Summaries IntegrationAdapted comment analysis for OB-GYNPython service
Comment Summaries UIStrengths and growth areas displayHTML/JS component
ILP TemplateWord document template with sectionspython-docx template
Reflection PromptsPGY-level appropriate promptsDatabase seed
ILP Download EndpointAPI to generate and download ILPFlask route

Demo Script (End of Week 7 - FINAL DEMO)

Demo 3A: Enhanced Personal Dashboard

  1. Login as OB-GYN resident: Authenticate as test resident
  2. Show trajectory chart: Scores over time for Milestones
  3. Show expected level: Overlay showing PGY-3 expected vs actual
  4. Switch to Procedures: See trajectory for procedure scores
  5. Show AI summaries: Strengths and areas for growth

Demo 3B: ILP Generation

  1. Click “Download ILP” button: On resident dashboard
  2. Show download starts: Browser downloads .docx file
  3. Open Word document: Show pre-populated content
  4. Highlight auto-filled sections: Milestone scores, feedback highlights
  5. Show reflection prompt: PGY-appropriate prompt text
  6. Show editable sections: Blank goal fields ready for input

Demo 3C: Full User Journey

  1. Start as new resident: First login experience
  2. View personal dashboard: All evaluation data
  3. Explore trajectory: Understand progress over time
  4. Read feedback summary: AI-generated insights
  5. Download ILP: Get pre-populated template
  6. Ready for faculty meeting: ILP prepared with data

Definition of Done

  • Trajectory visualization shows score history over time
  • Expected level comparison displays correctly by PGY
  • AI comment summaries generate for OB-GYN residents
  • Summaries display strengths and growth areas
  • ILP Word document generates with correct template
  • Pre-populated data appears correctly in document
  • Reflection prompts match resident’s PGY level
  • Download works reliably across browsers
  • Code reviewed and merged to main
  • Research team validates ILP template content

Research Team Inputs Needed

ItemDescriptionNeeded By
Reflection PromptsText for PGY 1-4 promptsWeek 6 Day 1
Expected LevelsTarget scores by PGY per milestoneWeek 6 Day 1
ILP Template ReviewValidation of auto-populated sectionsWeek 7 Day 3