# Math Course Audit Report

**Date:** May 20, 2026  
**Scope:** 2nd Grade Math Curriculum (32 weeks)

---

## Executive Summary

The math course has **32 generator files** but only **8 weeks** have substantial content. The remaining 24 weeks are either empty placeholders or small templates.

### Key Findings

| Category | Count | Weeks |
|----------|-------|-------|
| Complete (300+ lines) | 6 | 2, 4, 5, 6, 13, 32 |
| Template (100-200 lines) | 14 | 14-24, 26-28 |
| Empty (0 lines) | 12 | 1, 3, 7-12, 17, 25, 29-31 |

---

## Current Architecture Issues

### 1. Self-Contained Generators
Each week's `generate_weekN.py` contains all day functions inline:
```python
def monday():
    # All HTML built inline
    s1 = '<p class="note">...</p>'
    s2 = '<div class="mgrid">...</div>'
    return page_multi(2, "Monday", "Topic", s1 + s2 + ...)
```

**Problem:** No code reuse, hard to maintain consistent layout changes.

### 2. Layout Inconsistency
- **Week 2:** 60 activities (12/day) — too crowded
- **Week 6:** 59 activities (11.8/day) — too crowded
- **Week 13:** 28 activities (5.6/day) — possibly too sparse

**Target:** 6 activities/day maximum (per user preference).

### 3. No Shared Day Modules
Unlike ELA curriculum, math has no shared `monday.py`, `tuesday.py`, etc.

---

## Proposed Solution: Option B (Shared Modules)

### Architecture

```
Math/
├── math_helpers.py       # CSS, page(), sec(), b(), bw(), bl(), SVG generators
├── monday.py             # generate_monday(week_dir, week_num, day_data)
├── tuesday.py            # generate_tuesday(...)
├── wednesday.py          # generate_wednesday(...)
├── thursday.py           # generate_thursday(...)
├── friday.py             # generate_friday(...)
├── teacher_guide.py      # generate_teacher_guide(...)
├── generate_week2.py     # Data-driven: defines day_data dicts
├── generate_week4.py     # Data-driven
└── ...
```

### Benefits

1. **Consistent layout** — Change Monday's structure in one place
2. **Data-driven** — Week generators define WHAT, not HOW
3. **Easier auditing** — Clear separation of content vs. presentation
4. **Maintainable** — Add new activity types once, use everywhere

---

## Implementation Status

### ✅ Completed

1. **Shared day modules created:**
   - `monday.py` — 10 activity builders
   - `tuesday.py` — 7 activity builders
   - `wednesday.py` — 7 activity builders
   - `thursday.py` — 7 activity builders
   - `friday.py` — 8 activity builders
   - `teacher_guide.py` — Combined teacher guide generator

2. **Week 2 converted:**
   - `generate_week2_new.py` — Data-driven implementation
   - Generates 6 PDFs (5 days + teacher guide)
   - Same content, cleaner structure

### 🔄 In Progress

3. **Weeks 4, 5, 6 refactoring** — Need conversion to data-driven format

4. **Weeks 13, 32 refactoring** — Smaller but need conversion

5. **Template weeks (14-24, 26-28)** — Easy conversion, mostly structural

6. **Empty weeks (1, 3, 7-12, 17, 25, 29-31)** — Create from scratch using new system

---

## Activity Type Library

### Current Activity Builders

| Type | Description | Used In |
|------|-------------|---------|
| `tens_ones_count` | Count groups of ten sticks | Monday |
| `tens_ones_chart` | Fill tens/ones table | Mon, Wed, Fri |
| `expanded_form` | Write number as tens + ones | Tue, Wed, Fri |
| `build_from_expanded` | Combine expanded form | Tue, Wed, Fri |
| `draw_base10` | Draw rods and cubes | Mon, Wed |
| `compare` | Write >, <, or = | Wed, Fri |
| `word_problems` | Word problem container | All days |
| `digit_place` | Identify tens/ones place | Wed, Fri |
| `decompose` | Show number as different addends | Tuesday |
| `place_value_table` | Full place value table | Tuesday |
| `money_tens_ones` | Money as tens/ones | Thursday |
| `group_into_tens` | Group items into tens | Thursday |
| `shopping_table` | Shopping price table | Thursday |
| `riddles` | Place value riddles | Thursday |

### Extensible Design

New activity types can be added by:
1. Adding builder function to appropriate day module
2. Registering in `build_activity_section()` builders dict
3. Using in week data: `{"type": "my_new_type", "data": {...}}`

---

## Migration Plan

### Phase 1: Convert Existing Content (Weeks 2, 4, 5, 6, 13, 32)

1. ✅ Week 2 — **DONE** (`generate_week2_new.py`)
2. Week 4 — Convert to data-driven
3. Week 5 — Convert to data-driven
4. Week 6 — Convert to data-driven
5. Week 13 — Convert to data-driven
6. Week 32 — Convert to data-driven

### Phase 2: Template Weeks (14-24, 26-28)

These are mostly structural templates. Convert by:
1. Extract activity patterns
2. Map to existing activity types or create new ones
3. Generate data-driven versions

### Phase 3: Empty Weeks (1, 3, 7-12, 17, 25, 29-31)

Create from scratch using:
1. New shared module system
2. Consistent 6-activity layout
3. Appropriate activity types for topic

---

## Recommendations

1. **Keep both versions temporarily:**
   - `generate_week2.py` (old) — for comparison
   - `generate_week2_new.py` (new) — for testing
   - Once validated, rename and remove old

2. **Validate output:**
   - Compare PDFs side-by-side
   - Check teacher guide formatting
   - Verify all activities render correctly

3. **Incremental migration:**
   - Convert one week at a time
   - Test thoroughly before moving on
   - Document any new activity types needed

4. **Consider cleanup:**
   - Remove empty placeholder files after conversion
   - Consolidate duplicate activity builders
   - Update `math_helpers.py` if new helpers needed

---

## Next Steps

1. **Review Week 2 output** — Compare new vs. old PDFs
2. **Decide on migration pace** — 1 week/day? 1 week/weekend?
3. **Start Week 4 conversion** — Next most complete week
4. **Document activity patterns** — Build reference guide for future weeks

---

## File Locations

- **Shared modules:** `~/Home_School/2nd_Grade/Math/{monday,tuesday,wednesday,thursday,friday,teacher_guide}.py`
- **New Week 2:** `~/Home_School/2nd_Grade/Math/generate_week2_new.py`
- **Old Week 2:** `~/Home_School/2nd_Grade/Math/generate_week2.py`
- **Generated PDFs:** `~/Home_School/2nd_Grade/Math/Week_2/`
