feat: ajoute StatsAutres
parent
d213191fc3
commit
f8109fe524
11
src/index.ts
11
src/index.ts
|
@ -18,6 +18,8 @@ import { mermaidDiagramStatsGeneralesMensuelles } from "./statistiques/v2/genera
|
||||||
import { publishStatsGenerales } from "./notion/publish/v2/publishStatsGenerales";
|
import { publishStatsGenerales } from "./notion/publish/v2/publishStatsGenerales";
|
||||||
import { typeEvenementsProcedurePenale } from "./data/TypeEvenementsPenal";
|
import { typeEvenementsProcedurePenale } from "./data/TypeEvenementsPenal";
|
||||||
import { nettoyerDonneesFamilles } from "./data/nettoyage/familles/preparerDonneesFamilles";
|
import { nettoyerDonneesFamilles } from "./data/nettoyage/familles/preparerDonneesFamilles";
|
||||||
|
import { statsAutresDesc } from "./statistiques/v2/autres/StatsAutres";
|
||||||
|
import { computeStatsAutres } from "./statistiques/v2/autres/computeStatsAutres";
|
||||||
|
|
||||||
type ProcessOptions = {
|
type ProcessOptions = {
|
||||||
dryRun: boolean;
|
dryRun: boolean;
|
||||||
|
@ -109,6 +111,7 @@ function buildProcessOptions(): ProcessOptions {
|
||||||
|
|
||||||
const statsPenales = computeStatsPenales(familles);
|
const statsPenales = computeStatsPenales(familles);
|
||||||
const statsSociales = computeStatsSociales(familles);
|
const statsSociales = computeStatsSociales(familles);
|
||||||
|
const statsAutres = computeStatsAutres(familles);
|
||||||
const statsGeneralesMensuelles = computeStatsGeneralesMensuelles(familles);
|
const statsGeneralesMensuelles = computeStatsGeneralesMensuelles(familles);
|
||||||
const mermaidDiagramStatsGeneralesMensuellesCode =
|
const mermaidDiagramStatsGeneralesMensuellesCode =
|
||||||
mermaidDiagramStatsGeneralesMensuelles(statsGeneralesMensuelles);
|
mermaidDiagramStatsGeneralesMensuelles(statsGeneralesMensuelles);
|
||||||
|
@ -133,6 +136,7 @@ function buildProcessOptions(): ProcessOptions {
|
||||||
generales: statsGenerales,
|
generales: statsGenerales,
|
||||||
penales: statsPenales,
|
penales: statsPenales,
|
||||||
sociales: statsSociales,
|
sociales: statsSociales,
|
||||||
|
statsAutres: statsAutres,
|
||||||
StatsGeneralesMensuelles: statsGeneralesMensuelles,
|
StatsGeneralesMensuelles: statsGeneralesMensuelles,
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
|
@ -173,5 +177,12 @@ function buildProcessOptions(): ProcessOptions {
|
||||||
statsSocialesDesc,
|
statsSocialesDesc,
|
||||||
statsSociales
|
statsSociales
|
||||||
);
|
);
|
||||||
|
await publishStatsToPage(
|
||||||
|
notionClient,
|
||||||
|
"15f168be-9f19-806a-a22e-ed68137f905e",
|
||||||
|
header,
|
||||||
|
statsAutresDesc,
|
||||||
|
statsAutres
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { StatsType } from "../desc/StatsDesc";
|
||||||
|
|
||||||
|
export const statsAutresDesc = {
|
||||||
|
label: "Stats Sociales",
|
||||||
|
stats: {
|
||||||
|
nbFamillesSuppressionCAF: {
|
||||||
|
label: "Nb Familles avec une suppression CAF"
|
||||||
|
},
|
||||||
|
nbFamillesControleFiscal: {
|
||||||
|
label: "Nb Familles ayant eu un contrôle fiscal"
|
||||||
|
},
|
||||||
|
nbFamillesControleURSAFF: {
|
||||||
|
label: "Nb Familles ayant eu un contrôle URSAFF"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type StatsAutres = StatsType<typeof statsAutresDesc>;
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { Famille, isExResistant, isResistant } from "../../../data/Famille";
|
||||||
|
import { filterFamillesWithOneOfEvenementsOfType } from "../filterFamillesWithOneOfEvenementsOfType";
|
||||||
|
import { StatsAutres } from "./StatsAutres";
|
||||||
|
|
||||||
|
export function computeStatsAutres(familles: Famille[]): StatsAutres {
|
||||||
|
const famillesResistantesOuEx = familles.filter(
|
||||||
|
(f) => isResistant(f) || isExResistant(f)
|
||||||
|
);
|
||||||
|
const statsAutres: StatsAutres = {
|
||||||
|
nbFamillesControleFiscal: filterFamillesWithOneOfEvenementsOfType(
|
||||||
|
famillesResistantesOuEx,
|
||||||
|
"Contrôle fiscal"
|
||||||
|
).length,
|
||||||
|
|
||||||
|
nbFamillesControleURSAFF: filterFamillesWithOneOfEvenementsOfType(
|
||||||
|
famillesResistantesOuEx,
|
||||||
|
"Contrôle URSSAF"
|
||||||
|
).length,
|
||||||
|
|
||||||
|
nbFamillesSuppressionCAF: filterFamillesWithOneOfEvenementsOfType(
|
||||||
|
famillesResistantesOuEx,
|
||||||
|
"CAF suppression"
|
||||||
|
).length,
|
||||||
|
};
|
||||||
|
return statsAutres;
|
||||||
|
}
|
Loading…
Reference in New Issue