diff --git a/src/notion/publish/v2/publishStatsToPage.ts b/src/notion/publish/v2/publishStatsToPage.ts index 5ecbb82..8e3e2c3 100644 --- a/src/notion/publish/v2/publishStatsToPage.ts +++ b/src/notion/publish/v2/publishStatsToPage.ts @@ -6,7 +6,7 @@ import { StatDesc, StatGroupDesc, StatsType, -} from "../../../statistiques/v2/StatsDesc"; +} from "../../../statistiques/v2/desc/StatsDesc"; import { listAllChildrenBlocks } from "../../utils/listAllChildrenBlocks"; import { removeBlocks } from "../../utils/removeBlocks"; diff --git a/src/statistiques/v2/ELStatsV2.ts b/src/statistiques/v2/ELStatsV2.ts index f652e32..eea6347 100644 --- a/src/statistiques/v2/ELStatsV2.ts +++ b/src/statistiques/v2/ELStatsV2.ts @@ -1,5 +1,5 @@ import { statsPenalesDesc } from "./penales/StatsPenales"; -import { StatsType } from "./StatsDesc"; +import { StatsType } from "./desc/StatsDesc"; export const eLStatsV2Desc = { label: "Stats v2", diff --git a/src/statistiques/v2/StatsDesc.ts b/src/statistiques/v2/desc/StatsDesc.ts similarity index 91% rename from src/statistiques/v2/StatsDesc.ts rename to src/statistiques/v2/desc/StatsDesc.ts index 72da807..8629bdd 100644 --- a/src/statistiques/v2/StatsDesc.ts +++ b/src/statistiques/v2/desc/StatsDesc.ts @@ -1,4 +1,4 @@ -import { ValueFormatOptions } from "../../format/ValueFormatOptions"; +import { ValueFormatOptions } from "../../../format/ValueFormatOptions"; export type StatGroupDesc = { label: string; diff --git a/src/statistiques/v2/generales/StatsGenerales.ts b/src/statistiques/v2/generales/StatsGenerales.ts index cc5b58c..55b0871 100644 --- a/src/statistiques/v2/generales/StatsGenerales.ts +++ b/src/statistiques/v2/generales/StatsGenerales.ts @@ -1,4 +1,4 @@ -import { StatsType } from "../StatsDesc"; +import { StatsType } from "../desc/StatsDesc"; export const statsGeneralesDesc = { label: "Stats Générales", diff --git a/src/statistiques/v2/penales/StatsPenales.ts b/src/statistiques/v2/penales/StatsPenales.ts index e2a48d5..61b7b54 100644 --- a/src/statistiques/v2/penales/StatsPenales.ts +++ b/src/statistiques/v2/penales/StatsPenales.ts @@ -1,4 +1,4 @@ -import { StatsType } from "../StatsDesc"; +import { StatsType } from "../desc/StatsDesc"; export const statsPenalesDesc = { label: "Stats Pénales", diff --git a/src/statistiques/v2/penales/computeSankeyData.ts b/src/statistiques/v2/penales/computeSankeyData.ts new file mode 100644 index 0000000..a076cba --- /dev/null +++ b/src/statistiques/v2/penales/computeSankeyData.ts @@ -0,0 +1,19 @@ +import { Famille } from "../../../data/Famille"; +import { SankeyData } from "../sankey/SankeyData"; +export function computeSequencEvtPenalSankeyData(familles: Famille[]) { + const sankeyData: SankeyData = {}; + + familles.forEach((f) => { + // Compute all transitions, Events are already sorted + for (let index = 0; index < f.Evenements.length - 1; index++) { + const fromEvt = f.Evenements[index]; + const toEvt = f.Evenements[index + 1]; + const fromTransitions = sankeyData[fromEvt.Type] || {}; + sankeyData[fromEvt.Type] = { + ...fromTransitions, + [toEvt.Type]: (fromTransitions[toEvt.Type] || 0) + 1, + }; + } + }); + return sankeyData; +} diff --git a/src/statistiques/v2/sankey/SankeyData.ts b/src/statistiques/v2/sankey/SankeyData.ts new file mode 100644 index 0000000..9e31946 --- /dev/null +++ b/src/statistiques/v2/sankey/SankeyData.ts @@ -0,0 +1,8 @@ +/** + * Sankey diagram transitions + */ +export type SankeyData = { + [fromKey: string]: { + [toKey: string]: number; + }; +}; diff --git a/src/statistiques/v2/sankey/sankeyDataToMermaidDiagram.ts b/src/statistiques/v2/sankey/sankeyDataToMermaidDiagram.ts new file mode 100644 index 0000000..7a9fe08 --- /dev/null +++ b/src/statistiques/v2/sankey/sankeyDataToMermaidDiagram.ts @@ -0,0 +1,5 @@ +import { SankeyData } from "./SankeyData"; + +eport function sankeyDataToMermaidDiagram(sankeyData: SankeyData) { + +} \ No newline at end of file diff --git a/src/statistiques/v2/sociales/StatsSociales.ts b/src/statistiques/v2/sociales/StatsSociales.ts index 80cace8..04ed465 100644 --- a/src/statistiques/v2/sociales/StatsSociales.ts +++ b/src/statistiques/v2/sociales/StatsSociales.ts @@ -1,4 +1,4 @@ -import { StatsType } from "../StatsDesc"; +import { StatsType } from "../desc/StatsDesc"; export const statsSocialesDesc = { label: "Stats Sociales",