Controller Scripts

Overview

This document lists the controller scripts/functions needed to execute various operations in LBH Educate.

Controllers are organized by functional domain to separate concerns between Journal Mode (reactive) and Ideas Mode (proactive).

Core Controllers

Data Import & Seeding Controllers

importSkillsFromCSV(csvFilePath)

importBehavioursFromCSV(csvFilePath)

importKnowledgeAreasFromCSV(csvFilePath, category)

importActivitiesFromCSV(csvFilePath, knowledgeAreaId)

matchSkillNameToTaxonomy(skillNameString)

seedDatabase()

Authentication Controllers

initiateOAuthFlow(provider)

handleOAuthCallback(authToken, provider)

getCurrentUser()

signOut()

Child Profile Controllers

createChildProfile(userId, childData)

updateChildProfile(childId, updatedData)

getChildrenForUser(userId)

getChildById(childId)

transferChildOwnership(childId, newOwnerId)

archiveChild(childId)

Photo & Media Controllers

capturePhoto()

selectPhotoFromLibrary()

uploadPhoto(photoData, childId)

deletePhoto(photoUrl)

Journal Entry Controllers

createJournalEntry(childId, photoUrl, notes, entryDate)

updateJournalEntry(entryId, updatedData)

deleteJournalEntry(entryId)

getEntriesForChild(childId, filters, pagination)

getEntryById(entryId)

searchEntries(userId, searchQuery, filters)

AI Analysis Controllers

analyzePhoto(photoUrl, contextNotes)

suggestTemplate(aiAnalysisData, childAge)

suggestSkills(templateId, aiAnalysisData, childAge)

suggestBehaviours(templateId, aiAnalysisData, childAge)

learnFromUserCorrections(entryId, aiSuggestions, userSelections)

Template Controllers

getTemplateById(templateId)

searchTemplates(searchQuery)

getTemplatesForActivity(activityKeywords)

getCuratedTemplates()

Skill & Behaviour Tagging Controllers

getAllSkills()

getSkillsByCategory(category)

searchSkills(searchQuery)

getAllBehaviours()

searchBehaviours(searchQuery)

addSkillsToEntry(entryId, skillsArray)

addBehavioursToEntry(entryId, behavioursArray)

removeSkillFromEntry(entryId, skillId)

removeBehaviourFromEntry(entryId, behaviourId)

createCustomSkill(userId, skillName, category)

createCustomBehaviour(userId, behaviourName)

Skill Progress Controllers

calculateSkillProgress(childId, skillId)

getProgressForChild(childId)

getProgressForSkill(childId, skillId)

identifySkillGaps(childId)

getProgressTimeline(childId, dateRange)

Ideas Mode - Knowledge Area & Activity Controllers

getAllKnowledgeAreas()

getKnowledgeAreasByCategory(category)

getActivitiesForKnowledgeArea(knowledgeAreaId, progressionLevel)

getAllActivities()

getActivitiesForSkill(skillId, childAge)

searchActivities(searchQuery, filters)

getCuratedActivities()

Ideas Mode - Recommendation Controllers

generatePersonalizedSuggestions(childId)

getSuggestedActivitiesForChild(childId, filters)

bookmarkActivity(childId, activityId)

dismissSuggestion(childId, activityId, reason)

markActivityCompleted(suggestionId, journalEntryId)

refreshSuggestions(childId)

Live CV / Reporting Controllers

generateLiveCV(childId, dateRange, options)

exportLiveCVAsPDF(cvId)

exportLiveCVAsJSON(cvId)

shareLiveCV(cvId, recipientEmail)

getReportHistory(childId)

Data Analysis & Insights Controllers

getActivityMetrics(childId, dateRange)

getSkillCategoryBreakdown(childId)

getEntryTrends(childId, dateRange)

detectMilestones(childId)

Processing Pipelines

Journal Entry Creation Pipeline

End-to-end flow:

  1. capturePhoto() or selectPhotoFromLibrary() → Photo acquired
  2. uploadPhoto() → Photo stored in cloud
  3. createJournalEntry() → Entry record created
  4. analyzePhoto() → AI analyzes photo and context
  5. suggestTemplate() → Template suggestions generated
  6. User selects template (or skips)
  7. suggestSkills() + suggestBehaviours() → Skill and behaviour tags pre-selected
  8. User confirms/modifies skills and behaviours
  9. addSkillsToEntry() + addBehavioursToEntry() → Skills and behaviours linked to entry
  10. calculateSkillProgress() → Child's progress updated
  11. learnFromUserCorrections() → AI learning feedback

Key orchestration controller: orchestrateEntryCreation(childId, photoData, notes, entryDate, userSkillSelections, userBehaviourSelections)

Ideas Mode Recommendation Pipeline

End-to-end flow:

  1. User enters Ideas Mode or system runs periodic analysis
  2. identifySkillGaps() → Gaps identified
  3. generatePersonalizedSuggestions() → Activities matched to gaps
  4. Activities displayed with filters
  5. User bookmarks activities → bookmarkActivity()
  6. User completes activity and creates entry → markActivityCompleted()
  7. Loop back: new entry updates skill progress → gap analysis refreshes

Key orchestration controller: orchestrateIdeasMode(childId)

Live CV Generation Pipeline

End-to-end flow:

  1. User requests report for date range
  2. generateLiveCV() → Queries and compiles data
  3. exportLiveCVAsPDF() or exportLiveCVAsJSON() → Format conversion
  4. shareLiveCV() → Optional distribution
  5. Report stored in history → getReportHistory()

Key orchestration controller: orchestrateCVGeneration(childId, dateRange, format, options)

Function Inventory

By Functional Domain

Data Import & Seeding: 6 functions Authentication: 4 functions Child Profiles: 6 functions Photo & Media: 4 functions Journal Entries: 5 functions AI Analysis: 5 functions (added behaviour suggestions) Templates: 4 functions Skills & Behaviour Tagging: 12 functions (expanded to include behaviours) Skill Progress: 5 functions Knowledge Areas & Activities (Ideas Mode): 7 functions (expanded to include knowledge areas) Recommendations (Ideas Mode): 6 functions Live CV / Reporting: 5 functions Data Analysis & Insights: 4 functions Pipeline Orchestrators: 3 functions

Total: ~76 controller functions

Notes