feat: header Procédure Pénale
parent
2394396b2c
commit
29de3198f5
|
@ -1,8 +1,10 @@
|
|||
import { Period } from "../period/Period";
|
||||
import { isPeriodContaining } from "../period/isPeriodContaining";
|
||||
import { TypeEvenement } from "./TypeEvenement";
|
||||
import { typesEvenementsPenal } from "./TypeEvenementsPenal";
|
||||
import { TypeEvenementsPenal } from "./TypeEvenementsPenal";
|
||||
import {
|
||||
isEvtTypeProcedurePenale,
|
||||
isEvtTypeProcedurePenaleHorsGendarmerie,
|
||||
} from "./TypeEvenementsPenal";
|
||||
import { typesEvenementsSocial as typesEvenementsCivil } from "./TypeEvenementsSocial";
|
||||
import { TypesEvenementsSocial as TypesEvenementsCivil } from "./TypeEvenementsSocial";
|
||||
|
||||
|
@ -15,20 +17,14 @@ export type EvenementFamille = Readonly<{
|
|||
"Enfants concernés": string;
|
||||
}>;
|
||||
|
||||
export function isProcedurePenale(evenement: EvenementFamille): boolean {
|
||||
return (
|
||||
typesEvenementsPenal.includes(evenement.Type as TypeEvenementsPenal) &&
|
||||
evenement.Type !== "Mise en demeure de scolarisation"
|
||||
);
|
||||
export function isEvtProcedurePenale(evenement: EvenementFamille): boolean {
|
||||
return isEvtTypeProcedurePenale(evenement.Type);
|
||||
}
|
||||
|
||||
export function isProcedurePenaleHorsGendarmerie(
|
||||
evenement: EvenementFamille
|
||||
): boolean {
|
||||
return (
|
||||
isProcedurePenale(evenement) &&
|
||||
evenement.Type !== "Gendarmerie/Forces de l'ordre"
|
||||
);
|
||||
return isEvtTypeProcedurePenaleHorsGendarmerie(evenement.Type);
|
||||
}
|
||||
|
||||
export function isCompositionPenale(evenement: EvenementFamille): boolean {
|
||||
|
|
|
@ -1,28 +1,49 @@
|
|||
import { TypeEvenement } from "./TypeEvenement";
|
||||
|
||||
export type TypeEvenementsPenal = (typeof typesEvenementsPenal)[number];
|
||||
export const typesEvenementsPenal = [
|
||||
"Mise en demeure de scolarisation",
|
||||
|
||||
"Gendarmerie/Forces de l'ordre",
|
||||
|
||||
"Réquisition judiciaire",
|
||||
// Procureur
|
||||
"Audition procureur",
|
||||
|
||||
"Refus CRPC",
|
||||
"Acceptation CRPC", // PLaceholder see does not exist in Notion yet // See https://discord.com/channels/990921361121746984/1245360366322585691/1248260713634336839
|
||||
"Classement pénal sans suite",
|
||||
|
||||
"Composition pénale refusée",
|
||||
"Composition pénale acceptée",
|
||||
|
||||
"Refus CRPC",
|
||||
"Acceptation CRPC", // PLaceholder see does not exist in Notion yet // See https://discord.com/channels/990921361121746984/1245360366322585691/1248260713634336839
|
||||
|
||||
"Tribunal correctionnel",
|
||||
"Administrateur AD'HOC",
|
||||
"Appel du 1er jugement",
|
||||
"Stage parentalité",
|
||||
|
||||
"Réquisition judiciaire",
|
||||
"Appel du 2eme jugement", // placeholder
|
||||
|
||||
"Tribunal de police judiciaire",
|
||||
|
||||
"Classement pénal sans suite",
|
||||
"Acceptation avertissement pénal probatoire",
|
||||
"Stage parentalité",
|
||||
"Réquisition judiciaire",
|
||||
|
||||
// Tribunal
|
||||
"Tribunal correctionnel",
|
||||
"Appel du 1er jugement",
|
||||
"Appel du 2eme jugement", // placeholder
|
||||
"Tribunal de police judiciaire",
|
||||
"Administrateur AD'HOC",
|
||||
] as const;
|
||||
|
||||
export function isEvtTypeProcedurePenale(evtType: TypeEvenement): boolean {
|
||||
return (
|
||||
typesEvenementsPenal.includes(evtType as TypeEvenementsPenal) &&
|
||||
evtType !== "Mise en demeure de scolarisation"
|
||||
);
|
||||
}
|
||||
|
||||
export const typeEvenementsProcedurePenale = typesEvenementsPenal.filter(
|
||||
isEvtTypeProcedurePenale
|
||||
);
|
||||
|
||||
export function isEvtTypeProcedurePenaleHorsGendarmerie(
|
||||
evtType: TypeEvenement
|
||||
): boolean {
|
||||
return (
|
||||
isEvtTypeProcedurePenale(evtType) &&
|
||||
evtType !== "Gendarmerie/Forces de l'ordre"
|
||||
);
|
||||
}
|
||||
|
|
16
src/index.ts
16
src/index.ts
|
@ -17,6 +17,7 @@ import { computeStatsGeneralesMensuelles } from "./statistiques/v2/generales/com
|
|||
import { mermaidDiagramStatsGeneralesMensuelles } from "./statistiques/v2/generales/mermaidDiagramStatsGeneralesMensuelles";
|
||||
import { publishStatsGenerales } from "./notion/publish/v2/publishStatsGenerales";
|
||||
import { nettoyerDonneesFamilles } from "./data/nettoyage/nettoyerDonneesFamilles";
|
||||
import { typeEvenementsProcedurePenale } from "./data/TypeEvenementsPenal";
|
||||
|
||||
type ProcessOptions = {
|
||||
dryRun: boolean;
|
||||
|
@ -133,11 +134,16 @@ function buildProcessOptions(): ProcessOptions {
|
|||
console.log("Publishing statistics...");
|
||||
await publishStatisticsToNotion(elStats, currentDate, notionClient);
|
||||
|
||||
const header = `
|
||||
Note: Sauf mention contraire les statistiques sont basées sur les familles résistantes & ex-résistantes (en ignorant les évènements hors de la période d'appartenance à EL')
|
||||
Dernière mise à jour le ${formatDate(currentDate, "dd/MM/yyyy à HH:mm")}
|
||||
const header = `Notes:
|
||||
- Dernière mise à jour le ${formatDate(currentDate, "dd/MM/yyyy à HH:mm")}
|
||||
- Sauf mention contraire les statistiques sont basées sur les familles résistantes & ex-résistantes (en ignorant les évènements hors de la période d'appartenance à EL')`;
|
||||
const headerPenale =
|
||||
header +
|
||||
`
|
||||
- La Procédure Pénale ici inclus les évènemnts de type ${typeEvenementsProcedurePenale.join(
|
||||
", "
|
||||
)}.`;
|
||||
|
||||
`;
|
||||
await publishStatsGenerales(
|
||||
notionClient,
|
||||
header,
|
||||
|
@ -147,7 +153,7 @@ Dernière mise à jour le ${formatDate(currentDate, "dd/MM/yyyy à HH:mm")}
|
|||
await publishStatsToPage(
|
||||
notionClient,
|
||||
"969eac5c-a4eb-49d4-b4ad-c341c9c4c785",
|
||||
header,
|
||||
headerPenale,
|
||||
statsPenalesDesc,
|
||||
statsPenales
|
||||
);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
import { BlockObjectRequest } from "@notionhq/client/build/src/api-endpoints";
|
||||
|
||||
export function createCalloutBlock(content: string): CalloutBlockObjectRequest {
|
||||
return {
|
||||
callout: {
|
||||
rich_text: [
|
||||
{
|
||||
text: {
|
||||
content: content,
|
||||
},
|
||||
},
|
||||
],
|
||||
icon: {
|
||||
emoji: "💡",
|
||||
},
|
||||
color: "gray_background",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type CalloutBlockObjectRequest = Extract<
|
||||
BlockObjectRequest,
|
||||
{ callout: unknown }
|
||||
>;
|
|
@ -1,12 +1,12 @@
|
|||
import { Client } from "@notionhq/client";
|
||||
import { createMermaidCodeBlock } from "../blocks/createMermaidCodeBlock";
|
||||
import { createParagraphBlock } from "../blocks/createParagraphBlock";
|
||||
import { createStatGroupChildrenListItemBlock } from "./createStatGroupListItemBlock";
|
||||
import { updatePageContent } from "./updatePageContent";
|
||||
import {
|
||||
StatsGenerales,
|
||||
statsGeneralesDesc,
|
||||
} from "../../../statistiques/v2/generales/StatsGenerales";
|
||||
import { createCalloutBlock } from "../blocks/createCalloutBlock";
|
||||
|
||||
export async function publishStatsGenerales(
|
||||
notionClient: Client,
|
||||
|
@ -14,7 +14,7 @@ export async function publishStatsGenerales(
|
|||
statsGenerales: StatsGenerales,
|
||||
mermaidDiagramStatsGeneralesMensuelles: string
|
||||
) {
|
||||
const headerBlock = createParagraphBlock(header);
|
||||
const headerBlock = createCalloutBlock(header);
|
||||
const statsBlocks = createStatGroupChildrenListItemBlock(
|
||||
statsGeneralesDesc,
|
||||
statsGenerales
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
isEvenementBefore,
|
||||
isProcureur,
|
||||
isGendarmerie,
|
||||
isProcedurePenale,
|
||||
isEvtProcedurePenale,
|
||||
EvenementFamille,
|
||||
isProcedurePenaleHorsGendarmerie,
|
||||
} from "../../../data/EvenementFamille";
|
||||
|
@ -62,7 +62,7 @@ export function computeStatsPenales(familles: Famille[]): StatsPenales {
|
|||
nbFamillesMisesEnDemeure: famillesMisesEnDemeure.length,
|
||||
nbFamillesAvecProcedurePenale: filterFamillesWithOneOfEvenements(
|
||||
famillesResistantesOuEx,
|
||||
isProcedurePenale
|
||||
isEvtProcedurePenale
|
||||
).length,
|
||||
nbFamillesAvecGendarmerie: famillesGendarmerie.length,
|
||||
nbFamillesAvecGendarmerieSansSuiteACeJour:
|
||||
|
|
Loading…
Reference in New Issue