< Summary

Information
Class: EHonda.KicktippAi.Core.MatchPrediction
Assembly: EHonda.KicktippAi.Core
File(s): /home/runner/work/KicktippAi/KicktippAi/src/Core/IPredictionRepository.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 237
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%210%
get_Match()100%11100%
set_Match(...)100%210%
get_Prediction()100%11100%
set_Prediction(...)100%210%

File(s)

/home/runner/work/KicktippAi/KicktippAi/src/Core/IPredictionRepository.cs

#LineLine coverage
 1using NodaTime;
 2
 3namespace EHonda.KicktippAi.Core;
 4
 5/// <summary>
 6/// Repository interface for persisting and retrieving match predictions.
 7/// Currently designed for Bundesliga 2025/26 season.
 8/// </summary>
 9public interface IPredictionRepository
 10{
 11    /// <summary>
 12    /// Saves a prediction for a specific match.
 13    /// </summary>
 14    /// <param name="match">The match to predict.</param>
 15    /// <param name="prediction">The prediction for the match.</param>
 16    /// <param name="model">The AI model used to generate the prediction.</param>
 17    /// <param name="tokenUsage">JSON string containing token usage information from the API.</param>
 18    /// <param name="cost">The cost in USD for generating the prediction.</param>
 19    /// <param name="communityContext">The community context (rules) used for the prediction.</param>
 20    /// <param name="contextDocumentNames">Names of context documents used for this prediction.</param>
 21    /// <param name="cancellationToken">Cancellation token.</param>
 22    /// <returns>A task representing the asynchronous operation.</returns>
 23    Task SavePredictionAsync(Match match, Prediction prediction, string model, string tokenUsage, double cost, string co
 24
 25    /// <summary>
 26    /// Retrieves a prediction for a specific match using the specified model and community context.
 27    /// </summary>
 28    /// <param name="match">The match to get the prediction for.</param>
 29    /// <param name="model">The AI model used to generate the prediction.</param>
 30    /// <param name="communityContext">The community context used for the prediction.</param>
 31    /// <param name="cancellationToken">Cancellation token.</param>
 32    /// <returns>The prediction if found, otherwise null.</returns>
 33    Task<Prediction?> GetPredictionAsync(Match match, string model, string communityContext, CancellationToken cancellat
 34
 35    /// <summary>
 36    /// Retrieves full prediction metadata for a specific match using the specified model and community context.
 37    /// Includes context document names and timestamps for outdated checks.
 38    /// </summary>
 39    /// <param name="match">The match to get the prediction for.</param>
 40    /// <param name="model">The AI model used to generate the prediction.</param>
 41    /// <param name="communityContext">The community context used for the prediction.</param>
 42    /// <param name="cancellationToken">Cancellation token.</param>
 43    /// <returns>The prediction metadata if found, otherwise null.</returns>
 44    Task<PredictionMetadata?> GetPredictionMetadataAsync(Match match, string model, string communityContext, Cancellatio
 45
 46    /// <summary>
 47    /// Retrieves a prediction for a specific match by team names, start time, model, and community context.
 48    /// </summary>
 49    /// <param name="homeTeam">The home team name.</param>
 50    /// <param name="awayTeam">The away team name.</param>
 51    /// <param name="startsAt">The match start time.</param>
 52    /// <param name="model">The AI model used to generate the prediction.</param>
 53    /// <param name="communityContext">The community context used for the prediction.</param>
 54    /// <param name="cancellationToken">Cancellation token.</param>
 55    /// <returns>The prediction if found, otherwise null.</returns>
 56    Task<Prediction?> GetPredictionAsync(string homeTeam, string awayTeam, ZonedDateTime startsAt, string model, string 
 57
 58    /// <summary>
 59    /// Retrieves all matches for a specific match day.
 60    /// </summary>
 61    /// <param name="matchDay">The match day number (1-34 for Bundesliga).</param>
 62    /// <param name="cancellationToken">Cancellation token.</param>
 63    /// <returns>A collection of matches for the specified match day.</returns>
 64    Task<IReadOnlyList<Match>> GetMatchDayAsync(int matchDay, CancellationToken cancellationToken = default);
 65
 66    /// <summary>
 67    /// Retrieves all matches with their predictions for a specific match day using the specified model and community co
 68    /// </summary>
 69    /// <param name="matchDay">The match day number (1-34 for Bundesliga).</param>
 70    /// <param name="model">The AI model used to generate the predictions.</param>
 71    /// <param name="communityContext">The community context used for the predictions.</param>
 72    /// <param name="cancellationToken">Cancellation token.</param>
 73    /// <returns>A collection of matches with their predictions (if any) for the specified match day.</returns>
 74    Task<IReadOnlyList<MatchPrediction>> GetMatchDayWithPredictionsAsync(int matchDay, string model, string communityCon
 75
 76    /// <summary>
 77    /// Retrieves all predictions made with the specified model and community context.
 78    /// </summary>
 79    /// <param name="model">The AI model used to generate the predictions.</param>
 80    /// <param name="communityContext">The community context used for the predictions.</param>
 81    /// <param name="cancellationToken">Cancellation token.</param>
 82    /// <returns>A collection of all match predictions for the specified model and community context.</returns>
 83    Task<IReadOnlyList<MatchPrediction>> GetAllPredictionsAsync(string model, string communityContext, CancellationToken
 84
 85    /// <summary>
 86    /// Checks if a prediction exists for a specific match using the specified model and community context.
 87    /// </summary>
 88    /// <param name="match">The match to check.</param>
 89    /// <param name="model">The AI model used to generate the prediction.</param>
 90    /// <param name="communityContext">The community context used for the prediction.</param>
 91    /// <param name="cancellationToken">Cancellation token.</param>
 92    /// <returns>True if a prediction exists, otherwise false.</returns>
 93    Task<bool> HasPredictionAsync(Match match, string model, string communityContext, CancellationToken cancellationToke
 94
 95    /// <summary>
 96    /// Saves a bonus prediction for a specific question.
 97    /// </summary>
 98    /// <param name="bonusQuestion">The original bonus question (for text observability).</param>
 99    /// <param name="bonusPrediction">The bonus prediction to save.</param>
 100    /// <param name="model">The AI model used to generate the prediction.</param>
 101    /// <param name="tokenUsage">JSON string containing token usage information from the API.</param>
 102    /// <param name="cost">The cost in USD for generating the prediction.</param>
 103    /// <param name="communityContext">The community context (rules) used for the prediction.</param>
 104    /// <param name="contextDocumentNames">Names of context documents used for this prediction.</param>
 105    /// <param name="cancellationToken">Cancellation token.</param>
 106    /// <returns>A task representing the asynchronous operation.</returns>
 107    Task SaveBonusPredictionAsync(BonusQuestion bonusQuestion, BonusPrediction bonusPrediction, string model, string tok
 108
 109    /// <summary>
 110    /// Retrieves a bonus prediction for a specific question using the specified model and community context.
 111    /// </summary>
 112    /// <param name="questionId">The ID of the bonus question.</param>
 113    /// <param name="model">The AI model used to generate the prediction.</param>
 114    /// <param name="communityContext">The community context used for the prediction.</param>
 115    /// <param name="cancellationToken">Cancellation token.</param>
 116    /// <returns>The bonus prediction if found, otherwise null.</returns>
 117    Task<BonusPrediction?> GetBonusPredictionAsync(string questionId, string model, string communityContext, Cancellatio
 118
 119    /// <summary>
 120    /// Retrieves a bonus prediction by question text and community context.
 121    /// This allows lookup for the same question text with different form IDs.
 122    /// </summary>
 123    /// <param name="questionText">The text of the bonus question.</param>
 124    /// <param name="model">The AI model used to generate the prediction.</param>
 125    /// <param name="communityContext">The community context used for the prediction.</param>
 126    /// <param name="cancellationToken">Cancellation token.</param>
 127    /// <returns>The bonus prediction if found, otherwise null.</returns>
 128    Task<BonusPrediction?> GetBonusPredictionByTextAsync(string questionText, string model, string communityContext, Can
 129
 130    /// <summary>
 131    /// Retrieves full bonus prediction metadata by question text and community context.
 132    /// Includes context document names and timestamps for outdated checks.
 133    /// </summary>
 134    /// <param name="questionText">The text of the bonus question.</param>
 135    /// <param name="model">The AI model used to generate the prediction.</param>
 136    /// <param name="communityContext">The community context used for the prediction.</param>
 137    /// <param name="cancellationToken">Cancellation token.</param>
 138    /// <returns>The bonus prediction metadata if found, otherwise null.</returns>
 139    Task<BonusPredictionMetadata?> GetBonusPredictionMetadataByTextAsync(string questionText, string model, string commu
 140
 141    /// <summary>
 142    /// Retrieves all bonus predictions made with the specified model and community context.
 143    /// </summary>
 144    /// <param name="model">The AI model used to generate the predictions.</param>
 145    /// <param name="communityContext">The community context used for the predictions.</param>
 146    /// <param name="cancellationToken">Cancellation token.</param>
 147    /// <returns>A collection of all bonus predictions for the specified model and community context.</returns>
 148    Task<IReadOnlyList<BonusPrediction>> GetAllBonusPredictionsAsync(string model, string communityContext, Cancellation
 149
 150    /// <summary>
 151    /// Checks if a bonus prediction exists for a specific question using the specified model and community context.
 152    /// </summary>
 153    /// <param name="questionId">The ID of the bonus question.</param>
 154    /// <param name="model">The AI model used to generate the prediction.</param>
 155    /// <param name="communityContext">The community context used for the prediction.</param>
 156    /// <param name="cancellationToken">Cancellation token.</param>
 157    /// <returns>True if a bonus prediction exists, otherwise false.</returns>
 158    Task<bool> HasBonusPredictionAsync(string questionId, string model, string communityContext, CancellationToken cance
 159
 160    /// <summary>
 161    /// Gets the current reprediction index for a specific match using the specified model and community context.
 162    /// </summary>
 163    /// <param name="match">The match to check.</param>
 164    /// <param name="model">The AI model used to generate the prediction.</param>
 165    /// <param name="communityContext">The community context used for the prediction.</param>
 166    /// <param name="cancellationToken">Cancellation token.</param>
 167    /// <returns>The current reprediction index, or -1 if no prediction exists.</returns>
 168    Task<int> GetMatchRepredictionIndexAsync(Match match, string model, string communityContext, CancellationToken cance
 169
 170    /// <summary>
 171    /// Gets the current reprediction index for a specific bonus question using the specified model and community contex
 172    /// </summary>
 173    /// <param name="questionText">The text of the bonus question.</param>
 174    /// <param name="model">The AI model used to generate the prediction.</param>
 175    /// <param name="communityContext">The community context used for the prediction.</param>
 176    /// <param name="cancellationToken">Cancellation token.</param>
 177    /// <returns>The current reprediction index, or -1 if no prediction exists.</returns>
 178    Task<int> GetBonusRepredictionIndexAsync(string questionText, string model, string communityContext, CancellationTok
 179
 180    /// <summary>
 181    /// Saves a repredicted match prediction with the next reprediction index.
 182    /// </summary>
 183    /// <param name="match">The match to predict.</param>
 184    /// <param name="prediction">The prediction for the match.</param>
 185    /// <param name="model">The AI model used to generate the prediction.</param>
 186    /// <param name="tokenUsage">JSON string containing token usage information from the API.</param>
 187    /// <param name="cost">The cost in USD for generating the prediction.</param>
 188    /// <param name="communityContext">The community context (rules) used for the prediction.</param>
 189    /// <param name="contextDocumentNames">Names of context documents used for this prediction.</param>
 190    /// <param name="repredictionIndex">The reprediction index for this prediction.</param>
 191    /// <param name="cancellationToken">Cancellation token.</param>
 192    /// <returns>A task representing the asynchronous operation.</returns>
 193    Task SaveRepredictionAsync(Match match, Prediction prediction, string model, string tokenUsage, double cost, string 
 194
 195    /// <summary>
 196    /// Saves a repredicted bonus prediction with the next reprediction index.
 197    /// </summary>
 198    /// <param name="bonusQuestion">The original bonus question (for text observability).</param>
 199    /// <param name="bonusPrediction">The bonus prediction to save.</param>
 200    /// <param name="model">The AI model used to generate the prediction.</param>
 201    /// <param name="tokenUsage">JSON string containing token usage information from the API.</param>
 202    /// <param name="cost">The cost in USD for generating the prediction.</param>
 203    /// <param name="communityContext">The community context (rules) used for the prediction.</param>
 204    /// <param name="contextDocumentNames">Names of context documents used for this prediction.</param>
 205    /// <param name="repredictionIndex">The reprediction index for this prediction.</param>
 206    /// <param name="cancellationToken">Cancellation token.</param>
 207    /// <returns>A task representing the asynchronous operation.</returns>
 208    Task SaveBonusRepredictionAsync(BonusQuestion bonusQuestion, BonusPrediction bonusPrediction, string model, string t
 209
 210    /// <summary>
 211    /// Get match prediction costs and counts grouped by reprediction index for cost analysis.
 212    /// Used specifically by the cost command to include all repredictions.
 213    /// </summary>
 214    /// <param name="model">The AI model used to generate predictions.</param>
 215    /// <param name="communityContext">The community context used for predictions.</param>
 216    /// <param name="matchdays">Optional list of matchdays to filter by. If null, all matchdays are included.</param>
 217    /// <param name="cancellationToken">Cancellation token.</param>
 218    /// <returns>Dictionary mapping reprediction index to (cost, count) tuple.</returns>
 219    Task<Dictionary<int, (double cost, int count)>> GetMatchPredictionCostsByRepredictionIndexAsync(string model, string
 220
 221    /// <summary>
 222    /// Get bonus prediction costs and counts grouped by reprediction index for cost analysis.
 223    /// Used specifically by the cost command to include all repredictions.
 224    /// </summary>
 225    /// <param name="model">The AI model used to generate predictions.</param>
 226    /// <param name="communityContext">The community context used for predictions.</param>
 227    /// <param name="cancellationToken">Cancellation token.</param>
 228    /// <returns>Dictionary mapping reprediction index to (cost, count) tuple.</returns>
 229    Task<Dictionary<int, (double cost, int count)>> GetBonusPredictionCostsByRepredictionIndexAsync(string model, string
 230}
 231
 232/// <summary>
 233/// Represents a match combined with its prediction (if any).
 234/// </summary>
 1235public record MatchPrediction(
 1236    Match Match,
 1237    Prediction? Prediction);