fix: stats sociales
parent
8dda887349
commit
e718874a3a
|
@ -34,7 +34,7 @@ export const statsGeneralesDesc = {
|
|||
},
|
||||
|
||||
apresPoursuiteProcureur: {
|
||||
label: "Nb Familles Après poursuite procureur",
|
||||
label: "Après poursuite procureur",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -7,51 +7,54 @@ import {
|
|||
isGendarmerie,
|
||||
isProcedurePenale,
|
||||
} from "../../../data/EvenementFamille";
|
||||
import { Famille } from "../../../data/Famille";
|
||||
import { Famille, isExResistant, isResistant } from "../../../data/Famille";
|
||||
import { average } from "../../../utils/math/average";
|
||||
import { filterFamillesWithOneOfEvenements } from "../filterFamillesWithOneOfEvenements";
|
||||
import { filterFamillesWithOneOfEvenementsOfType } from "../filterFamillesWithOneOfEvenementsOfType";
|
||||
import { StatsPenales } from "./StatsPenales";
|
||||
|
||||
export function computeStatsPenales(familles: Famille[]): StatsPenales {
|
||||
const famillesResistantesOuEx = familles.filter(
|
||||
(f) => isResistant(f) || isExResistant(f)
|
||||
);
|
||||
const famillesMisesEnDemeure = filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Mise en demeure de scolarisation"
|
||||
);
|
||||
const famillesAvecGendarmerie = filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
isGendarmerie
|
||||
);
|
||||
const statsPenales: StatsPenales = {
|
||||
nbFamillesMisesEnDemeure: famillesMisesEnDemeure.length,
|
||||
nbFamillesAvecGendarmerie: famillesAvecGendarmerie.length,
|
||||
nbFamillesAvecProcedurePenale: filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
isProcedurePenale
|
||||
).length,
|
||||
).length,
|
||||
procureur: {
|
||||
nbFamillesAuditionProcureur: filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
isAuditionProcureurOuCRPC
|
||||
).length,
|
||||
compositionPenales: computeCompositionPenales(familles),
|
||||
crpc: computeCrpc(familles),
|
||||
nbFamillesClassementSansSuite: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Classement pénal sans suite"
|
||||
).length,
|
||||
nbFamillesRappelALaLoi: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Rappel à la loi"
|
||||
).length,
|
||||
},
|
||||
tribunalCorrectionnel: computeTribunalCorrectionnel(familles),
|
||||
nbFamillesAdministrateurAdhoc: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Administrateur AD'HOC"
|
||||
).length,
|
||||
nbFamillesTribunalDePolice: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Tribunal de police judiciaire"
|
||||
).length,
|
||||
intervalGendarmerieProcureur: computeIntervalGendarmerieProcureur(familles),
|
||||
|
@ -61,16 +64,19 @@ export function computeStatsPenales(familles: Famille[]): StatsPenales {
|
|||
return statsPenales;
|
||||
}
|
||||
|
||||
function computeCrpc(familles: Famille[]): StatsPenales["procureur"]["crpc"] {
|
||||
const famillesConcernees = filterFamillesWithOneOfEvenements(familles, (e) =>
|
||||
isCRPC(e)
|
||||
function computeCrpc(
|
||||
famillesResistantesOuEx: Famille[]
|
||||
): StatsPenales["procureur"]["crpc"] {
|
||||
const famillesConcernees = filterFamillesWithOneOfEvenements(
|
||||
famillesResistantesOuEx,
|
||||
(e) => isCRPC(e)
|
||||
);
|
||||
const acceptees = filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Acceptation CRPC"
|
||||
);
|
||||
const refusees = filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Refus CRPC"
|
||||
);
|
||||
|
||||
|
@ -82,17 +88,18 @@ function computeCrpc(familles: Famille[]): StatsPenales["procureur"]["crpc"] {
|
|||
}
|
||||
|
||||
function computeCompositionPenales(
|
||||
familles: Famille[]
|
||||
famillesResistantesOuEx: Famille[]
|
||||
): StatsPenales["procureur"]["compositionPenales"] {
|
||||
const famillesConcernees = filterFamillesWithOneOfEvenements(familles, (e) =>
|
||||
isCompositionPenale(e)
|
||||
const famillesConcernees = filterFamillesWithOneOfEvenements(
|
||||
famillesResistantesOuEx,
|
||||
(e) => isCompositionPenale(e)
|
||||
);
|
||||
const acceptees = filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Composition pénale acceptée"
|
||||
);
|
||||
const refusees = filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Composition pénale refusée"
|
||||
);
|
||||
|
||||
|
@ -104,19 +111,19 @@ function computeCompositionPenales(
|
|||
}
|
||||
|
||||
function computeTribunalCorrectionnel(
|
||||
familles: Famille[]
|
||||
famillesResistantesOuEx: Famille[]
|
||||
): StatsPenales["tribunalCorrectionnel"] {
|
||||
const now = new Date();
|
||||
const famillesPassees = filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
(e) => e.Type === "Tribunal correctionnel" && isEvenementBefore(e, now)
|
||||
);
|
||||
const famillesProgrammees = filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
(e) => e.Type === "Tribunal correctionnel" && !isEvenementBefore(e, now)
|
||||
);
|
||||
|
||||
const famillesRecidiveTribunal = familles.filter((f) => {
|
||||
const famillesRecidiveTribunal = famillesResistantesOuEx.filter((f) => {
|
||||
return (
|
||||
f.Evenements.filter((e) => e.Type === "Tribunal correctionnel").length > 1
|
||||
);
|
||||
|
@ -127,7 +134,7 @@ function computeTribunalCorrectionnel(
|
|||
nbFamillesProgrammees: famillesProgrammees.length,
|
||||
nbFamillesRecidive: famillesRecidiveTribunal.length,
|
||||
nbFamilleAppelDuJugement: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Appel du jugement"
|
||||
).length,
|
||||
};
|
||||
|
|
|
@ -3,64 +3,69 @@ import {
|
|||
isInformationPreoccupante,
|
||||
isProcedureCivile,
|
||||
} from "../../../data/EvenementFamille";
|
||||
import { Famille } from "../../../data/Famille";
|
||||
import { Famille, isExResistant, isResistant } from "../../../data/Famille";
|
||||
import { filterFamillesWithOneOfEvenements } from "../filterFamillesWithOneOfEvenements";
|
||||
import { filterFamillesWithOneOfEvenementsOfType } from "../filterFamillesWithOneOfEvenementsOfType";
|
||||
import { StatsSociales } from "./StatsSociales";
|
||||
|
||||
export function computeStatsSociales(familles: Famille[]): StatsSociales {
|
||||
const famillesResistantesOuEx = familles.filter(
|
||||
(f) => isResistant(f) || isExResistant(f)
|
||||
);
|
||||
const now = new Date();
|
||||
const statsCiviles: StatsSociales = {
|
||||
nbFamillesProcedureCivile: filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
(e) => isProcedureCivile(e)
|
||||
).length,
|
||||
|
||||
nbFamilleAvecIP: filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
isInformationPreoccupante
|
||||
).length,
|
||||
nbFamilleAvecAssistanceEducative: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Assistance éducative"
|
||||
).length,
|
||||
|
||||
nbFamilleAvecAuditionDesEnfants: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Audition des enfants"
|
||||
).length,
|
||||
jugePourEnfant: {
|
||||
nbFamillesPassees: filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
(e) => e.Type === "Juge pour enfants" && isEvenementBefore(e, now)
|
||||
).length,
|
||||
nbFamillesConvoquées: filterFamillesWithOneOfEvenements(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
(e) => e.Type === "Juge pour enfants" && !isEvenementBefore(e, now)
|
||||
).length,
|
||||
},
|
||||
nbFamilleAvecClassementSuiteIP: filterFamillesWithOneOfEvenementsOfType(
|
||||
familles,
|
||||
famillesResistantesOuEx,
|
||||
"Classement suite IP"
|
||||
).length,
|
||||
propFamilleSocial: {
|
||||
classementApresIP: familles.filter(
|
||||
classementApresIP: famillesResistantesOuEx.filter(
|
||||
(f) => f.Social === "Classement après IP"
|
||||
).length,
|
||||
classementApresMijeOuAemo: familles.filter(
|
||||
classementApresMijeOuAemo: famillesResistantesOuEx.filter(
|
||||
(f) => f.Social === "Classement après MIJE ou AEMO ou"
|
||||
).length,
|
||||
convocationJugePourEnfants: familles.filter(
|
||||
convocationJugePourEnfants: famillesResistantesOuEx.filter(
|
||||
(f) => f.Social === "Convocation Juge pour Enfants"
|
||||
).length,
|
||||
convoqueeServiceSociaux: familles.filter(
|
||||
convoqueeServiceSociaux: famillesResistantesOuEx.filter(
|
||||
(f) => f.Social === "Convoquée par les services sociaux"
|
||||
).length,
|
||||
enqueteEnCours: familles.filter((f) => f.Social === "Enquête en cours")
|
||||
.length,
|
||||
mije: familles.filter((f) => f.Social === "MJIE").length,
|
||||
pasDenquete: familles.filter((f) => f.Social === "Pas d’enquête sociale")
|
||||
.length,
|
||||
enqueteEnCours: famillesResistantesOuEx.filter(
|
||||
(f) => f.Social === "Enquête en cours"
|
||||
).length,
|
||||
mije: famillesResistantesOuEx.filter((f) => f.Social === "MJIE").length,
|
||||
pasDenquete: famillesResistantesOuEx.filter(
|
||||
(f) => f.Social === "Pas d’enquête sociale"
|
||||
).length,
|
||||
},
|
||||
};
|
||||
return statsCiviles;
|
||||
|
|
Loading…
Reference in New Issue