feat(Core): update DTOs and shared models

This commit is contained in:
2026-08-09 21:01:38 +02:00
parent 6337e63a77
commit 5475c3ac51
58 changed files with 3418 additions and 30 deletions
@@ -0,0 +1,63 @@
using System.Text.Json.Serialization;
namespace FinlyticCore.Dtos.Sentiment;
/// <summary>
/// Probabilities dictionary containing positive, negative, and neutral softmax scores.
/// </summary>
public record FinBertProbabilities
{
/// <summary>
/// Gets or sets the positive probability score (0.0 to 1.0).
/// </summary>
[JsonPropertyName("positive")]
public double Positive { get; init; }
/// <summary>
/// Gets or sets the negative probability score (0.0 to 1.0).
/// </summary>
[JsonPropertyName("negative")]
public double Negative { get; init; }
/// <summary>
/// Gets or sets the neutral probability score (0.0 to 1.0).
/// </summary>
[JsonPropertyName("neutral")]
public double Neutral { get; init; }
}
/// <summary>
/// Data transfer object holding the result of a FinBERT sentiment analysis.
/// </summary>
public record FinBertResultDto
{
/// <summary>
/// Gets or sets the dominant sentiment label ("POSITIVE", "NEGATIVE", "NEUTRAL").
/// </summary>
[JsonPropertyName("label")]
public string Label { get; init; } = "NEUTRAL";
/// <summary>
/// Gets or sets the compound score (-1.0 to +1.0).
/// </summary>
[JsonPropertyName("compoundScore")]
public double CompoundScore { get; init; }
/// <summary>
/// Gets or sets the highest confidence score (0.0 to 1.0).
/// </summary>
[JsonPropertyName("confidence")]
public double Confidence { get; init; }
/// <summary>
/// Gets or sets the probability breakdown.
/// </summary>
[JsonPropertyName("probabilities")]
public FinBertProbabilities Probabilities { get; init; } = new();
/// <summary>
/// Gets or sets the short summary snippet highlighting the impact of the article.
/// </summary>
[JsonPropertyName("summarySnippet")]
public string? SummarySnippet { get; init; }
}
@@ -0,0 +1,147 @@
using System.Text.Json.Serialization;
namespace FinlyticCore.Dtos.Sentiment;
/// <summary>
/// Article metadata referenced inside an ISIN analysis event.
/// </summary>
public record IsinAnalysisArticleRef
{
/// <summary>
/// Gets or sets the article identifier.
/// </summary>
[JsonPropertyName("articleId")]
public string ArticleId { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the article title.
/// </summary>
[JsonPropertyName("title")]
public string Title { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the article source name.
/// </summary>
[JsonPropertyName("source")]
public string Source { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the publication timestamp in ISO-8601 format.
/// </summary>
[JsonPropertyName("publishedAt")]
public string PublishedAt { get; init; } = string.Empty;
}
/// <summary>
/// Individual chronological analysis entry inside an ISIN summary file.
/// </summary>
public record IsinAnalysisEntry
{
/// <summary>
/// Gets or sets the unique analysis ID (e.g. "sent_20260722_001").
/// </summary>
[JsonPropertyName("analysisId")]
public string AnalysisId { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the analysis timestamp in ISO-8601 format.
/// </summary>
[JsonPropertyName("timestamp")]
public string Timestamp { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the referenced article details.
/// </summary>
[JsonPropertyName("article")]
public IsinAnalysisArticleRef Article { get; init; } = new();
/// <summary>
/// Gets or sets the FinBERT analysis result.
/// </summary>
[JsonPropertyName("finbertResult")]
public FinBertResultDto FinbertResult { get; init; } = new();
/// <summary>
/// Gets or sets the summary snippet.
/// </summary>
[JsonPropertyName("summarySnippet")]
public string SummarySnippet { get; init; } = string.Empty;
}
/// <summary>
/// Current summary aggregate header inside an ISIN sentiment summary file.
/// </summary>
public record IsinCurrentSummary
{
/// <summary>
/// Gets or sets the average compound score (-1.0 to +1.0).
/// </summary>
[JsonPropertyName("compoundScore")]
public double CompoundScore { get; init; }
/// <summary>
/// Gets or sets the overall sentiment label ("POSITIVE", "NEGATIVE", "NEUTRAL").
/// </summary>
[JsonPropertyName("sentimentLabel")]
public string SentimentLabel { get; init; } = "NEUTRAL";
/// <summary>
/// Gets or sets the average confidence across analyzed articles.
/// </summary>
[JsonPropertyName("avgConfidence")]
public double AvgConfidence { get; init; }
/// <summary>
/// Gets or sets the total number of articles analyzed for this ISIN.
/// </summary>
[JsonPropertyName("totalArticlesAnalyzed")]
public int TotalArticlesAnalyzed { get; init; }
/// <summary>
/// Gets or sets the overall synthesized sentiment text overview.
/// </summary>
[JsonPropertyName("text")]
public string Text { get; init; } = string.Empty;
}
/// <summary>
/// Data transfer object for an ISIN sentiment summary file (stored in data/summaries/isin/ISIN.json).
/// </summary>
public record IsinSentimentSummaryDto
{
/// <summary>
/// Gets or sets the ISIN code.
/// </summary>
[JsonPropertyName("isin")]
public string Isin { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the company name.
/// </summary>
[JsonPropertyName("companyName")]
public string CompanyName { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the sector name.
/// </summary>
[JsonPropertyName("sector")]
public string Sector { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the last updated timestamp in ISO-8601 format.
/// </summary>
[JsonPropertyName("lastUpdated")]
public string LastUpdated { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the current summary metrics and overview.
/// </summary>
[JsonPropertyName("currentSummary")]
public IsinCurrentSummary CurrentSummary { get; init; } = new();
/// <summary>
/// Gets or sets the list of historical analysis entries.
/// </summary>
[JsonPropertyName("analyses")]
public List<IsinAnalysisEntry> Analyses { get; init; } = [];
}
@@ -0,0 +1,99 @@
using System.Text.Json.Serialization;
namespace FinlyticCore.Dtos.Sentiment;
/// <summary>
/// Individual analysis entry inside a Sector sentiment summary file.
/// </summary>
public record SectorAnalysisEntry
{
/// <summary>
/// Gets or sets the unique analysis ID.
/// </summary>
[JsonPropertyName("analysisId")]
public string AnalysisId { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the timestamp in ISO-8601 format.
/// </summary>
[JsonPropertyName("timestamp")]
public string Timestamp { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the related asset ISIN.
/// </summary>
[JsonPropertyName("relatedIsin")]
public string RelatedIsin { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the article ID.
/// </summary>
[JsonPropertyName("articleId")]
public string ArticleId { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the FinBERT analysis result.
/// </summary>
[JsonPropertyName("finbertResult")]
public FinBertResultDto FinbertResult { get; init; } = new();
}
/// <summary>
/// Current summary aggregate header inside a Sector sentiment summary file.
/// </summary>
public record SectorCurrentSummary
{
/// <summary>
/// Gets or sets the sector compound score (-1.0 to +1.0).
/// </summary>
[JsonPropertyName("compoundScore")]
public double CompoundScore { get; init; }
/// <summary>
/// Gets or sets the overall sector sentiment label ("POSITIVE", "NEGATIVE", "NEUTRAL").
/// </summary>
[JsonPropertyName("sentimentLabel")]
public string SentimentLabel { get; init; } = "NEUTRAL";
/// <summary>
/// Gets or sets the list of active asset ISINs influencing the sector.
/// </summary>
[JsonPropertyName("activeIsins")]
public List<string> ActiveIsins { get; init; } = [];
/// <summary>
/// Gets or sets the overview text for the sector.
/// </summary>
[JsonPropertyName("text")]
public string Text { get; init; } = string.Empty;
}
/// <summary>
/// Data transfer object for a Sector sentiment summary file (stored in data/summaries/sectors/SectorName.json).
/// </summary>
public record SectorSentimentSummaryDto
{
/// <summary>
/// Gets or sets the sector name.
/// </summary>
[JsonPropertyName("sector")]
public string Sector { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the last updated timestamp in ISO-8601 format.
/// </summary>
[JsonPropertyName("lastUpdated")]
public string LastUpdated { get; init; } = string.Empty;
/// <summary>
/// Gets or sets the current sector summary metrics and overview.
/// </summary>
[JsonPropertyName("currentSummary")]
public SectorCurrentSummary CurrentSummary { get; init; } = new();
/// <summary>
/// Gets or sets the list of historical sector analysis entries.
/// </summary>
[JsonPropertyName("analyses")]
public List<SectorAnalysisEntry> Analyses { get; init; } = [];
}