[ { "Method": "StoryMemoryRepository.ListProcessedSceneResultIdsAsync", "Procedure": "dbo.StoryMemory_ListProcessedSceneResultIds", "Sql": "SELECT SceneResultID\nFROM dbo.StoryMemoryProcessedSceneResults\nWHERE ImportSessionID = @ImportSessionID\n AND ProcessorVersion = @ProcessorVersion;" }, { "Method": "StoryMemoryRepository.ListCharactersAsync", "Procedure": "dbo.StoryMemory_ListCharacters", "Sql": "SELECT * FROM dbo.StoryMemoryCharacters WHERE ImportSessionID = @ImportSessionID ORDER BY Significance DESC, DisplayName;" }, { "Method": "StoryMemoryRepository.ListCharacterAttributesAsync", "Procedure": "dbo.StoryMemory_ListCharacterAttributes", "Sql": "SELECT a.*\nFROM dbo.StoryMemoryCharacterAttributes a\nINNER JOIN dbo.StoryMemoryCharacters c ON c.StoryMemoryCharacterID = a.StoryMemoryCharacterID\nWHERE c.ImportSessionID = @ImportSessionID\n AND a.SupersededUtc IS NULL;" }, { "Method": "StoryMemoryRepository.ListLocationsAsync", "Procedure": "dbo.StoryMemory_ListLocations", "Sql": "SELECT * FROM dbo.StoryMemoryLocations WHERE ImportSessionID = @ImportSessionID ORDER BY DisplayName;" }, { "Method": "StoryMemoryRepository.ListAssetsAsync", "Procedure": "dbo.StoryMemory_ListAssets", "Sql": "SELECT * FROM dbo.StoryMemoryAssets WHERE ImportSessionID = @ImportSessionID ORDER BY DisplayName;" }, { "Method": "StoryMemoryRepository.ListAssignmentsAsync", "Procedure": "dbo.StoryMemory_ListAssignments", "Sql": "SELECT * FROM dbo.StoryMemoryIllustrationAssignments WHERE ImportSessionID = @ImportSessionID AND InvalidatedUtc IS NULL;" }, { "Method": "StoryMemoryRepository.GetAssignmentAsync", "Procedure": "dbo.StoryMemory_GetAssignment", "Sql": "SELECT * FROM dbo.StoryMemoryIllustrationAssignments WHERE ImportSessionID = @ImportSessionID AND EntityType = @EntityType AND EntityID = @EntityID AND InvalidatedUtc IS NULL;" }, { "Method": "StoryMemoryRepository.ListDemandsAsync", "Procedure": "dbo.StoryMemory_ListDemands", "Sql": "SELECT *\nFROM dbo.StoryMemoryIllustrationDemands\nWHERE ImportSessionID = @ImportSessionID;" }, { "Method": "StoryMemoryRepository.GetImportContextAsync", "Procedure": "dbo.StoryMemory_GetImportContext", "Sql": "SELECT\n AppearancePreference,\n COALESCE(PrimaryAgeGroup, N'') AS PrimaryAgeGroup,\n COALESCE(StoryEra, N'') AS StoryEra,\n COALESCE(StoryLocation, N'') AS StoryLocation\nFROM dbo.StoryMemoryImportPreferences\nWHERE ImportSessionID = @ImportSessionID;" }, { "Method": "StoryMemoryRepository.GetDiagnosticsAsync", "Procedure": "dbo.StoryMemory_GetDiagnostics", "Sql": "SELECT\n @ImportSessionID AS ImportSessionID,\n (SELECT COUNT(*) FROM dbo.StoryMemoryCharacters WHERE ImportSessionID = @ImportSessionID) AS CharacterCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryLocations WHERE ImportSessionID = @ImportSessionID) AS LocationCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryAssets WHERE ImportSessionID = @ImportSessionID) AS AssetCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryCharacterAliases a INNER JOIN dbo.StoryMemoryCharacters c ON c.StoryMemoryCharacterID = a.StoryMemoryCharacterID WHERE c.ImportSessionID = @ImportSessionID) AS AliasCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryCharacterAttributes a INNER JOIN dbo.StoryMemoryCharacters c ON c.StoryMemoryCharacterID = a.StoryMemoryCharacterID WHERE c.ImportSessionID = @ImportSessionID AND a.SupersededUtc IS NULL) AS AttributeCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryRelationships WHERE ImportSessionID = @ImportSessionID AND Active = 1) AS RelationshipCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryIllustrationAssignments WHERE ImportSessionID = @ImportSessionID AND InvalidatedUtc IS NULL) AS AssignmentCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryIllustrationAssignments WHERE ImportSessionID = @ImportSessionID AND InvalidatedUtc IS NULL AND IsFallback = 1) AS FallbackCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryIllustrationDemands WHERE ImportSessionID = @ImportSessionID) AS DemandCount,\n (SELECT COUNT(*) FROM dbo.StoryMemoryProcessedSceneResults WHERE ImportSessionID = @ImportSessionID) AS ProcessedSceneCount,\n (SELECT MAX(SceneResultID) FROM dbo.StoryMemoryProcessedSceneResults WHERE ImportSessionID = @ImportSessionID) AS LastProcessedSceneResultID,\n COALESCE((SELECT AppearancePreference FROM dbo.StoryMemoryImportPreferences WHERE ImportSessionID = @ImportSessionID), N'Balanced') AS AppearancePreference;" }, { "Method": "CharacterIntelligenceRepository.ListProfilesAsync", "Procedure": "dbo.CharacterIntelligence_ListProfiles", "Sql": "SELECT *\nFROM dbo.CharacterIntelligenceProfiles\nWHERE ImportSessionID = @ImportSessionID\nORDER BY IsRecurring DESC, Confidence DESC, CanonicalName;" } ]