This document is a project guide for LifeLoveMe development.

Universal Collection Framework

Technical architecture for describing collections in LifeLoveMe so the platform can support Ramcharitmanas (RCM), Bhagavad Gita, Yoga Sutra, Bible, Quran, Kamasutra, chanting, Ayurveda/wellness, family tree, Bollywood songs, books, poems, essays, documents, audio, and video—without rewriting application code for each corpus. Apps read metadata and data files; collection-specific behavior is expressed through types, manifests, and schemas, not hard-coded branches for every title.


1. Purpose

Ramcharitmanas (RCM) is the first proof-of-concept collection: it validates search, indexing, audio, read-along, dictionary hooks, and Smart Search at production-like depth.

The Universal Collection Framework (UCF) is the contract by which future collections plug into the same platform: same mental model for identity, files, search, media, relationships, and deployment—different content and optional capabilities per CollectionType.

This document defines files, fields, identifiers, and boundaries. It does not mandate a single implementation language or UI framework; it mandates discoverable, versionable data that any LifeLoveMe client can load.


2. Core principle

Every collection should be described by metadata and data files, not by hard-coded app logic.

Hard-coding is allowed only at the edges (bootstrap URLs, feature flags, temporary shims) and should shrink over time as the framework absorbs patterns.


3. Collection types

CollectionType is a coarse classifier for routing, UI defaults, and validation rules.

CollectionTypeTypical content
sacred_textScripture: verse/chapter structure, meanings, refs
chantingMantras, stotrams, short repeatable audio/text
song_catalogFilm/non-film songs, metadata, performers
family_treePeople, unions, lineage, dates, private graphs
bookLong-form books, chapters, optional page maps
document_setEssays, letters, mixed documents
media_collectionPrimarily audio/video with light item metadata
wellness_contentSleep, stress, yoga, Ayurveda-style supportive content (not diagnosis)

A collection may combine types in profiles (e.g. sacred_text + media_collection); the manifest should declare the primary type and secondary capabilities.


4. Standard collection files

Each collection SHOULD ship a consistent directory of standard files. Names are conventional; paths are implementation-defined (e.g. /collections/{CollectionID}/).

FileRole
collection_manifest.jsonIdentity, type, version, list of bundled files, feature flags, default hub/explorer entrypoints
index_definition.jsonWhich Part fields mean what, sort rules, search field map, LineRef/ItemRef rules for this collection
items.jsonCanonical list of items (or shard pointers if split)
search_index.jsonDenormalized or auxiliary structures for fast search (optional if generated at build time)
media_manifest.jsonCatalog of media assets keyed by MediaID
timing.jsonAlignment of media time ranges to ItemRef / LineRef (optional; collection-specific density)
dictionary.jsonLemmas, glosses, cross-references to ItemRef
aliases.jsonSurface forms → canonical keys / refs for search and Ask routing
relationships.jsonEdges between items (and optionally external entities)
references.jsonBibliography, edition notes, URL-stable citations
help.jsonUser-facing help: how to read refs, search modes, limitations

Sharding: Large collections MAY split items.json into items-000.json, … with manifest entries listing shards. Search shards MAY mirror the same pattern.

Omission: Files that do not apply may be absent; the manifest MUST declare which optional files are included vs absent so clients do not probe blindly.


5. Universal item schema

Required fields

FieldDescription
CollectionIDStable string ID for the corpus (e.g. RCM, GITA)
CollectionTypeOne of the types in §3 (primary)
ItemTypeFiner grain: line, verse, sutra, person, song, chapter, etc.
LineRef or ItemRefCanonical machine reference (see §6). Use one as primary per index_definition.json
DisplayRefHuman-facing ref string
SortKeySingle string or composite key for stable ordering within the collection
Part1Raw / Part1Sort / Part1DisplayAddressing tier 1 (raw source, sort token, display)
Part2Raw / Part2Sort / Part2DisplayAddressing tier 2
Part3Raw / Part3Sort / Part3DisplayAddressing tier 3
Part4Raw / Part4Sort / Part4DisplayAddressing tier 4 (metre code, verse tag, sutra label, etc.)
OriginalTextPrimary source text (Unicode)
MeaningHindiOptional but required field key present; use empty string if N/A
MeaningEnglishSame as above

Raw vs Sort vs Display

Optional fields

FieldDescription
TransliterationRoman or other transliteration of OriginalText
SummaryShort abstract
TagsFree or controlled vocabulary
ThemesThematic buckets for exploration
CharactersNamed entities (IDs or strings; relationships.json preferred for graph)
PlacesLocation names or IDs
AudioRefsList of MediaID or segment IDs
VideoRefsList of MediaID or segment IDs
ImageRefsIllustrations, scans
ReferenceRefsPointers into references.json
NotesEditorial, provenance, QA

6. Universal indexing

LineRef

LineRef identifies a primary textual line (or atomic item treated like a line):

LineRef = CollectionID.Part1Sort.Part2Sort.Part3Sort.Part4Sort

ItemRef

When a collection needs sub-line or multi-line packaged items (playlists, chanting cycles, UI cards):

ItemRef = LineRef.ItemNumberSort

ItemNumberSort is typically a padded ordinal under that line’s scope. If the collection has no sub-items, ItemRef may be omitted and LineRef is the sole canonical key.

Examples

ExampleComment
RCM.001.004.002.DoRCM-style kand / group / line-in-group / metre
RCM.001.208A.001.DoAlphanumeric middle segment preserved
GITA.002.018.000.VerseChapter / verse / filler / type
YOGA.001.002.000.SutraPada / sutra / pad / type
BIBLE.John.003.016.KJVBook name as Part1 sort token per collection profile
BOLLY.1975.SHOLAY.001.SongYear / work / track / type
FAMILY.AGARWAL.003.002.Person014Tree / branch / generation / person ordinal

Exact Part semantics are not global; they are declared in `index_definition.json` per collection so the same engine parses different Part layouts.


7. RCM mapping

Legacy Ramcharitmanas rows often carry RCM-specific columns. During migration and dual-read periods:

Legacy / RCM fieldUniversal role
RCMIDMaps to LegacyRef (display and backward compatibility)
LineRefNew universal primary identity (built from Parts)
LineIDLegacy / debug only; not a cross-collection standard
KandNumberPart1 (Sort/Display per index_definition)
DohaGroupNumberPart2
LineWithinGroupPart3
MetreTypePart4 (e.g. Do, Ch)

Migration policy


8. Media schema

Each row in media_manifest.json (or equivalent) SHOULD support:

FieldDescription
MediaIDStable unique ID within the platform or collection
CollectionIDOwning collection
MediaTypee.g. audio, video, image, subtitle
TitleDisplay title
FileNameOriginal file name (preserve for traceability)
PublicPathURL path when hosted on lean deploy
LocalPathPath for full/local builds
SourceURLOptional canonical external source (archive, rights holder)
StartItemRef / EndItemRefOptional span in item space (inclusive semantics per manifest)
DurationSecondsOptional
LanguageISO or manifest enum
PerformerGeneric credit
NarratorFor audiobooks / recitation
SingerFor songs
IncludeInDeployBoolean: ship with lean Netlify bundle
DeployTierSee below
NotesRights, quality, alternate encodings

DeployTier

ValueMeaning
betaSmall, curated subset allowed on lean deploy
fullPart of full corpus package (e.g. web_public_large, local archive)
externalNot bundled; streamed or downloaded from SourceURL / CDN with user consent
local_onlyNever shipped to public CDN; developer or personal mirror

9. Timing schema

Rows in timing.json (or embedded segments) align media to text:

FieldDescription
MediaIDLinks to media_manifest.json
CollectionIDRedundant but useful for sharded queries
ItemRef or LineRefTarget passage
StartTimeTextOptional human cue (mm:ss or SMPTE as policy)
StartSecondsFloat or decimal seconds from media start
EndSecondsExclusive or inclusive per manifest rule (document the rule once)
TimingSourcee.g. manual, asr, imported_air, community
TimingConfidencee.g. high, medium, low or numeric
NotesQA, alternate takes, drift correction

10. Relationship schema

Edges in relationships.json:

FieldDescription
RelationshipIDStable unique ID
CollectionIDScope (cross-collection edges: policy in manifest; may duplicate rows per side)
SourceItemRefStarting node
TargetItemRefEnding node
RelationshipTypeMachine enum (see examples)
RelationshipLabelOptional human label
StartDate / EndDateOptional ISO dates (family, historical figures)
NotesEvidence, confidence, source citation

Examples by domain

Relationship types SHOULD be registered in index_definition.json or collection_manifest.json so UIs can offer filters without code forks per type string.


11. Search framework

Search is implemented as modes over the same item corpus (and optional indices):

ModeRole
Smart SearchIntent parsing: references, dialog patterns, multi-term logic—collection profile defines capabilities
Text SearchMatch on OriginalText, transliteration, titles
Starts SearchPrefix / first-token style matching (performance-sensitive)
Index SearchDirect lookup by LineRef, ItemRef, or Part patterns
Meaning SearchMatch on MeaningHindi, MeaningEnglish, summaries
Boolean searchAND / OR / NOT with documented precedence
Wildcard searchGlob or regex subset per security policy
AliasesExpand surface forms via aliases.json
Future concept searchDictionary / ontology → item sets (not required for v1)

Default token rule (conventional)

Exact tokenization (Devanagari, ZWJ, chandrabindu) is locale-specific and must be specified per collection in the index definition—not hard-coded globally in app logic.


12. Ask LifeLoveMe routing layer

Ask LifeLoveMe is a global intent routing layer (box on home, plus APIs). It classifies utterances into intents and routes to the right surface:

Intent (example enum)Typical destination
learnHub, tutorials, primer content
searchExplorer with query pre-filled
meaningItem panel / meaning fields / dictionary
playPlayer + MediaID or search-first then play
readReader / Explorer read mode
explainGrounded explanation with citations where required
wellness_sleepWellness collection, sleep-safe copy
wellness_stressWellness collection + safety escalation templates
referenceReference / Help / references.json
relationshipGraph app or filtered relationship list
navigateLibrary, settings, collection picker

Routing SHOULD be data-driven (intent patterns, aliases) with collection hooks (e.g. “Gita 2.18” → GITA index profile). Fallback: honest “not in library yet” plus suggested collections.


13. App architecture

Logical apps (may be routes in one SPA or separate deployables):

SurfaceFunction
LifeLoveMe homeAsk LifeLoveMe + main entrance, announcements
LibraryLists all collections from manifests
HubFirst page for one collection: overview, samples, links to Explorer/Player
ExplorerSearch, read, play, study; heavy UX for one collection
PlayerFocused media / read-along; minimal chrome
Reference / HelpSources, indexing method, LineRef rules, search help
GraphRelationship visualization (family tree, character graph)

Clients load `collection_manifest.json` first, then lazy-load shards (items, search_index, media_manifest, etc.) according to flags.


14. Netlify deployment rules

Build pipelines SHOULD fail loudly if a lean deploy exceeds size budgets or if forbidden tiers are included.


15. Migration strategy

Staged rollout to avoid breaking the working RCM beta:

1. Keep RCM working — no regressions on search, play, read-along.

2. Add universal fields beside legacy RCM fields (dual-write / dual-read as needed).

3. Set `CollectionID=RCM` in manifest and items; treat RCM as first-class UCF collection.

4. Create generic collection library UI fed only by manifests (RCM entry first).

5. Create collection explorer wrapper that configures Explorer from manifest + index_definition (RCM becomes one profile).

6. Add small Gita sample — stress-test Parts and meaning search without full corpus.

7. Add chanting sample — short loop, media + timing smoke test.

8. Add family tree prototype — small relationships.json, Graph surface, privacy model.

9. Gradually retire RCM-only assumptions in code (replace with manifest-driven configuration).


16. Development guardrails


Document status: architecture spec. Revise when the first non-RCM collection ships or when LineRef rules are extended for new Part layouts.