mirror of
https://framagit.org/enfance-libre/statistiques
synced 2025-12-07 04:13:48 +00:00
feat: supprime stats departementales de pénal
This commit is contained in:
parent
4229719032
commit
8e2ca3a99b
3 changed files with 0 additions and 82 deletions
|
|
@ -176,32 +176,6 @@ export const statsPenalesDesc = {
|
|||
type: "group-list",
|
||||
stats: statsAmendesDesc,
|
||||
},
|
||||
parDepartements: {
|
||||
label: "Par départements",
|
||||
type: "group-list",
|
||||
stats: {
|
||||
nbFamilles: {
|
||||
label: "Nb familles",
|
||||
},
|
||||
pourcentageMED: {
|
||||
label: "% familles avec une Mise en demeure",
|
||||
unit: "%",
|
||||
},
|
||||
pourcentageProcedurePenaleHorsGendarmerie: {
|
||||
label:
|
||||
"% familles avec une Procédure Pénale différent de Gendarmerie (Procureur, Tribunal...)",
|
||||
unit: "%",
|
||||
},
|
||||
pourcentageTribunalCorrectionnel: {
|
||||
label: "% familles avec un evt Tribunal correctionnel",
|
||||
unit: "%",
|
||||
},
|
||||
pourcentageTribunalPolice: {
|
||||
label: "% familles avec un evt Tribunal de Police",
|
||||
unit: "%",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
import { Famille } from "../../../data/Famille";
|
||||
import { isEvtTypeProcedurePenaleHorsGendarmerie } from "../../../data/TypeEvenementsPenal";
|
||||
import { filterFamillesWithOneOfEvenements } from "../filterFamillesWithOneOfEvenements";
|
||||
import { filterFamillesWithOneOfEvenementsOfType } from "../filterFamillesWithOneOfEvenementsOfType";
|
||||
import { percent } from "../math/percent";
|
||||
import { nbFamillesAvecPagesLiees } from "../nbFamillesAvecPagesLiees";
|
||||
import { StatsPenales } from "./StatsPenales";
|
||||
|
||||
export function computeStatDepartement(
|
||||
famillesDepartements: Famille[]
|
||||
): StatsPenales["parDepartements"][string] {
|
||||
return {
|
||||
nbFamilles: nbFamillesAvecPagesLiees(famillesDepartements),
|
||||
pourcentageMED: percent(
|
||||
filterFamillesWithOneOfEvenementsOfType(
|
||||
famillesDepartements,
|
||||
"Mise en demeure de scolarisation"
|
||||
).length,
|
||||
famillesDepartements.length
|
||||
),
|
||||
pourcentageProcedurePenaleHorsGendarmerie: percent(
|
||||
filterFamillesWithOneOfEvenements(famillesDepartements, (e) =>
|
||||
isEvtTypeProcedurePenaleHorsGendarmerie(e.Type)
|
||||
).length,
|
||||
famillesDepartements.length
|
||||
),
|
||||
pourcentageTribunalCorrectionnel: percent(
|
||||
filterFamillesWithOneOfEvenements(
|
||||
famillesDepartements,
|
||||
(e) => e.Type === "Tribunal correctionnel"
|
||||
).length,
|
||||
famillesDepartements.length
|
||||
),
|
||||
pourcentageTribunalPolice: percent(
|
||||
filterFamillesWithOneOfEvenements(
|
||||
famillesDepartements,
|
||||
(e) => e.Type === "Tribunal de police judiciaire"
|
||||
).length,
|
||||
famillesDepartements.length
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
@ -22,9 +22,7 @@ import {
|
|||
FamilleAvecInfosProceduresPenales as FamilleAvecInfoProceduresPenales,
|
||||
} from "./computeFamilleAvecInfosProceduresPenales";
|
||||
import { computeIntervalMedGendarmerieOuProcureur } from "./intervals/computeIntervalMedGendarmerieOuProcureur";
|
||||
import { groupBy } from "lodash";
|
||||
import { computeStatsAmendes } from "./computeStatsAmendes";
|
||||
import { computeStatDepartement } from "./computeStatDepartement";
|
||||
|
||||
export type FamilleAvecInfoTribunaux = Famille & {
|
||||
infoTribunaux: InfoTribunalCorrectionnel[];
|
||||
|
|
@ -67,12 +65,6 @@ export function computeStatsPenales(familles: Famille[]): StatsPenales {
|
|||
};
|
||||
});
|
||||
|
||||
const famillesParDepartement = groupBy(
|
||||
famillesResistantesOuEx,
|
||||
(f) => f.Departement
|
||||
);
|
||||
const departements = Object.keys(famillesParDepartement).sort();
|
||||
|
||||
const famillesAvecInfoProceduresPenales: FamilleAvecInfoProceduresPenales[] =
|
||||
famillesResistantesOuEx.map(computeFamilleAvecInfosProceduresPenales);
|
||||
|
||||
|
|
@ -169,12 +161,6 @@ export function computeStatsPenales(familles: Famille[]): StatsPenales {
|
|||
famillesAvecInfoProceduresPenales
|
||||
),
|
||||
amendes: computeStatsAmendes(famillesResistantesOuEx),
|
||||
parDepartements: Object.fromEntries(
|
||||
departements.map((d) => [
|
||||
d,
|
||||
computeStatDepartement(famillesParDepartement[d]),
|
||||
])
|
||||
),
|
||||
};
|
||||
return statsPenales;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue