From 7825293390e46c06f38754b2ae199647cff4dada Mon Sep 17 00:00:00 2001 From: gosangam Date: Mon, 4 May 2026 00:12:10 +0530 Subject: [PATCH] feat: update project context --- PROJECT_CONTEXT.md | 81 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md index 3aa1c85a..43a1b644 100644 --- a/PROJECT_CONTEXT.md +++ b/PROJECT_CONTEXT.md @@ -63,6 +63,14 @@ spsays-training/ │ │ └── [slug]/ │ │ ├── page.tsx → Magazine issue listing (grouped by volume) │ │ └── [issue]/page.tsx → Individual issue reader with sidebar +│ ├── letters/ +│ │ ├── page.tsx → Letters index with 3-way nav (year/recipient/location) +│ │ ├── letters-nav.tsx → Client component for tab navigation +│ │ ├── letters-browser.tsx → Client component with search + pagination +│ │ ├── [slug]/page.tsx → Individual letter reader with prev/next +│ │ ├── year/[year]/page.tsx → Letters filtered by year +│ │ ├── recipient/[name]/page.tsx → Letters filtered by recipient +│ │ └── location/[name]/page.tsx → Letters filtered by location │ ├── essays/ │ │ ├── page.tsx → Essays grid page (searchable) │ │ ├── essays-grid.tsx → Client component for searchable essay grid @@ -126,6 +134,7 @@ spsays-training/ │ ├── other-documents.ts → Other Documents data access (Prisma, dedicated collections) │ ├── journals.ts → Journals data access (Prisma, dedicated collections) │ ├── magazines.ts → Magazines data access (Prisma, dedicated collections) +│ ├── letters.ts → Letters data access (Prisma, queries by year/recipient/location) │ └── jsons/books/ → Extracted JSON data (all books) │ ├── bg/, sb/, cc/, sb-1962/, kb/ → Original verse/prose books │ ├── nod/, tlc/, iso/, noi/ → Extracted from other.html @@ -138,11 +147,15 @@ spsays-training/ │ ├── essays/ → Essay JSON files (pre-1977, cc-essays, standalone, etc.) │ ├── other-documents/ → Other document JSON files (12 documents) │ ├── journals/ → Journal JSON files (2 journals, 300 chapters) -│ └── magazines/ → Magazine JSON files (2 magazines, 59 issues) -│ ├── btg/ → Back to Godhead (1944–1960), 29 issues -│ └── btg-1978/ → Back to Godhead (1966–1973), 30 issues +│ ├── magazines/ → Magazine JSON files (2 magazines, 59 issues) +│ │ ├── btg/ → Back to Godhead (1944–1960), 29 issues +│ │ └── btg-1978/ → Back to Godhead (1966–1973), 30 issues +│ └── letters/ → Letter JSON files (6,866 letters, grouped by year) +│ ├── index.json → Summary index (stats, top recipients/locations) +│ ├── 1947.json … 1977.json → 28 year-based letter files +│ └── undated.json → 58 undated letters ├── prisma/ -│ └── schema.prisma → Verse, BookMeta, ProseChapter, Essay, GlossaryEntry, OtherDocumentMeta, OtherDocumentChapter, JournalMeta, JournalChapter, MagazineMeta, MagazineIssue models +│ └── schema.prisma → Verse, BookMeta, ProseChapter, Essay, GlossaryEntry, OtherDocumentMeta, OtherDocumentChapter, JournalMeta, JournalChapter, MagazineMeta, MagazineIssue, Letter models ├── scripts/ │ ├── bg_extract.py → BG extraction from bg.html │ ├── sb_extract.py → SB extraction from sb.html @@ -179,6 +192,8 @@ spsays-training/ │ ├── btg_extract.py → BTG (1944–1960) extraction from btg-1960.html │ ├── btg_1978_extract.py → BTG (1966–1973) extraction from btg-1978.html │ ├── seed-magazines.ts → Magazines seeder (dedicated collections) +│ ├── letters_extract.py → Letters extraction from letters.html (6,866 letters) +│ ├── seed-letters.ts → Letters seeder (per-document inserts) │ ├── kb_extract_*.py → KB extraction scripts (intro, vol1, vol2) │ ├── inject-fonts.py → Inject @font-face rules into converted HTML │ └── fix-bengali-encoding.py → Fix Bengali font encoding in cc.html @@ -335,6 +350,27 @@ model MagazineIssue { @@map("magazine_issues") } +model Letter { + id String @id @default(auto()) @map("_id") @db.ObjectId + slug String @unique + recipients String[] // array of individual recipient names + recipientDisplay String // original combined string for display + date String? + dateRef String? + year Int? + month Int? + day Int? + location String? + salutation String? + paragraphs String[] + + @@index([year]) + @@index([recipients]) + @@index([location]) + @@index([year, month]) + @@map("letters") +} + model GlossaryEntry { id String @id @default(auto()) @map("_id") @db.ObjectId term String @@ -455,6 +491,27 @@ model GlossaryEntry { | Back to Godhead (1944–1960) | `btg` | 29 | 89 | Pre 1978 | btg-1960.html | | Back to Godhead (1966–1973) | `btg-1978` | 30 | 1,035 | Pre 1978 | btg-1978.html | +### Letters (stored in `letters` collection) + +| Metric | Value | +|--------|-------| +| Total letters | 6,866 | +| Unique recipients (individual) | 2,243 | +| Unique locations | 164 | +| Year range | 1947–1977 | +| Total paragraphs | 52,261 | + +**Top recipients**: Satsvarupa (182), Brahmananda (168), Hansadutta (117), Tamala Krsna (115), Gurudasa (103), Mukunda (105), Madhudvisa (90), Karandhara (90) + +**Top locations**: Los Angeles (1,392), Bombay (1,086), Vrindaban (532), Mayapur (305), London (264), Calcutta (250), Honolulu (239) + +**Schema notes**: +- `recipients` is an array of individual names (e.g., `["Mukunda", "Janaki"]`) +- `recipientDisplay` is the original combined string (e.g., `"Mukunda, Janaki"`) +- Searching for a recipient uses Prisma `{ has: name }` to match any letter where that person appears +- Multi-recipient groups are split by `,`, `;`, ` and `, ` & ` +- Trailing punctuation (`:`, `,`, `.`) cleaned from names + ### Other | Content | Collection | @@ -561,15 +618,29 @@ IAST transliteration → Devanagari via `indic-transliteration` library. Key fix | `/magazines/[slug]` | Magazine issue listing (grouped by volume) | | `/magazines/[slug]/[issue]` | Individual issue reader (slug-based, e.g., `v1-p1`, `no-17`) | +### Letters + +| Route | Content | +|-------|---------| +| `/letters` | Letters index with 3-way navigation tabs | +| `/letters?view=year` | Year grid (1947–1977) with search | +| `/letters?view=recipient` | Recipient list (2,243 individuals) with search + pagination | +| `/letters?view=location` | Location grid (164 locations) with search + pagination | +| `/letters/year/1968` | All letters from a specific year | +| `/letters/recipient/Mukunda` | All letters to/including a specific recipient | +| `/letters/location/Los%20Angeles` | All letters from a specific location | +| `/letters/[slug]` | Individual letter reader with prev/next navigation | + ### Other routes | Route | Content | |-------|---------| -| `/` | Landing page | +| `/` | Landing page (responsive 3-column grid) | | `/books` | Searchable book grid | | `/glossary` | Searchable glossary (2,749 entries) | | `/journals` | Journals (2 journals, 300 chapters) | | `/magazines` | Magazines (2 magazines, 59 issues, Pre 1978) | +| `/letters` | Letters (6,866 letters, 3-way navigation) | | `/rtfs` | RTF viewer (gated by ALLOW_RTF=true) | | `/api/verify-access` | Password protection endpoint |