Fix financial taxonomy snapshot normalization

This commit is contained in:
2026-03-13 19:01:56 -04:00
parent b1c9c0ef08
commit 30977dc15f
16 changed files with 1273 additions and 156 deletions

View File

@@ -312,12 +312,14 @@ function relativeDiff(left: number | null, right: number | null) {
return Math.abs(left - right) / baseline;
}
function periodStart(period: ResultPeriod) {
return period.periodStart ?? period.period_start ?? null;
function periodStart(period: ResultPeriod): string | null {
const start = ('periodStart' in period ? period.periodStart : undefined) ?? period.period_start ?? null;
return typeof start === 'string' ? start : null;
}
function periodEnd(period: ResultPeriod) {
return period.periodEnd ?? period.period_end ?? null;
function periodEnd(period: ResultPeriod): string | null {
const end = ('periodEnd' in period ? period.periodEnd : undefined) ?? period.period_end ?? null;
return typeof end === 'string' ? end : null;
}
function chooseDurationPeriodId(result: TaxonomyHydrationResult) {