Expose ARR disclosure gaps before statistical comparison

This commit is contained in:
2026-10-31 23:36:33 +08:00
parent ae84304e16
commit cce2fd8581
3 changed files with 57 additions and 7 deletions
+14
View File
@@ -31,6 +31,20 @@ export function arrDisclosureCoverage(snapshot: ResearchSnapshot, foundedYear?:
missing: companies.length - disclosed.size, records: claims.length };
});
}
export type ArrFieldGap = "date" | "currency" | "amount" | "estimate";
/** Prerequisites for inspecting exact, dated USD disclosures; never a comparability or audit verdict. */
export function arrFieldGaps(observation: ResearchObservation, asOf: string): ArrFieldGap[] {
const gaps: ArrFieldGap[] = [];
const day = calendarDay(observation.observedAt);
const end = calendarDay(asOf);
if (day === null || end === null || day > end) gaps.push("date");
if (observation.unit !== "USD") gaps.push("currency");
if (observation.bound !== "=" || !Number.isFinite(observation.value) || observation.value < 0) gaps.push("amount");
if (["estimate", "historical-estimate"].includes(observation.selection)) gaps.push("estimate");
return gaps;
}
export type IncomeStats = {
n: number; mean: number; median: number; min: number; max: number;
sampleDeviation: number | null; cv: number | null; meanMedianRatio: number | null;