增加按分类与成立年份浏览的 ARR 披露表

This commit is contained in:
2026-10-31 17:36:03 +08:00
parent 6410535ed9
commit f99a354db2
7 changed files with 141 additions and 32 deletions
+14
View File
@@ -1,6 +1,20 @@
import type { ResearchCompany, ResearchObservation, ResearchSnapshot } from "./ai-research";
export type IncomePoint = { company: ResearchCompany; observation: ResearchObservation; value: number };
/** An evidence ledger, never a comparable sample: retain historical claims and estimates separately. */
export function arrDisclosures(snapshot: ResearchSnapshot, options: { category?: string; foundedYear?: number } = {}) {
const companies = new Map(snapshot.companies.map((company) => [company.id, company]));
return snapshot.observations.flatMap((observation) => {
const company = companies.get(observation.company);
if (!company || ![2025, 2026].includes(company.year ?? 0) || observation.metric !== "arr" ||
!["signal", "estimate", "historical", "historical-estimate"].includes(observation.selection) ||
!Number.isFinite(observation.value) || observation.value < 0 ||
(options.category && company.cat !== options.category) ||
(options.foundedYear && company.year !== options.foundedYear)) return [];
return [{ company, observation }];
});
}
export type IncomeStats = {
n: number; mean: number; median: number; min: number; max: number;
sampleDeviation: number | null; cv: number | null; meanMedianRatio: number | null;