feat: header Procédure Pénale
parent
2394396b2c
commit
29de3198f5
|
@ -1,8 +1,10 @@
|
||||||
import { Period } from "../period/Period";
|
import { Period } from "../period/Period";
|
||||||
import { isPeriodContaining } from "../period/isPeriodContaining";
|
import { isPeriodContaining } from "../period/isPeriodContaining";
|
||||||
import { TypeEvenement } from "./TypeEvenement";
|
import { TypeEvenement } from "./TypeEvenement";
|
||||||
import { typesEvenementsPenal } from "./TypeEvenementsPenal";
|
import {
|
||||||
import { TypeEvenementsPenal } from "./TypeEvenementsPenal";
|
isEvtTypeProcedurePenale,
|
||||||
|
isEvtTypeProcedurePenaleHorsGendarmerie,
|
||||||
|
} from "./TypeEvenementsPenal";
|
||||||
import { typesEvenementsSocial as typesEvenementsCivil } from "./TypeEvenementsSocial";
|
import { typesEvenementsSocial as typesEvenementsCivil } from "./TypeEvenementsSocial";
|
||||||
import { TypesEvenementsSocial as TypesEvenementsCivil } from "./TypeEvenementsSocial";
|
import { TypesEvenementsSocial as TypesEvenementsCivil } from "./TypeEvenementsSocial";
|
||||||
|
|
||||||
|
@ -15,20 +17,14 @@ export type EvenementFamille = Readonly<{
|
||||||
"Enfants concernés": string;
|
"Enfants concernés": string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export function isProcedurePenale(evenement: EvenementFamille): boolean {
|
export function isEvtProcedurePenale(evenement: EvenementFamille): boolean {
|
||||||
return (
|
return isEvtTypeProcedurePenale(evenement.Type);
|
||||||
typesEvenementsPenal.includes(evenement.Type as TypeEvenementsPenal) &&
|
|
||||||
evenement.Type !== "Mise en demeure de scolarisation"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isProcedurePenaleHorsGendarmerie(
|
export function isProcedurePenaleHorsGendarmerie(
|
||||||
evenement: EvenementFamille
|
evenement: EvenementFamille
|
||||||
): boolean {
|
): boolean {
|
||||||
return (
|
return isEvtTypeProcedurePenaleHorsGendarmerie(evenement.Type);
|
||||||
isProcedurePenale(evenement) &&
|
|
||||||
evenement.Type !== "Gendarmerie/Forces de l'ordre"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isCompositionPenale(evenement: EvenementFamille): boolean {
|
export function isCompositionPenale(evenement: EvenementFamille): boolean {
|
||||||
|
|
|
@ -1,28 +1,49 @@
|
||||||
|
import { TypeEvenement } from "./TypeEvenement";
|
||||||
|
|
||||||
export type TypeEvenementsPenal = (typeof typesEvenementsPenal)[number];
|
export type TypeEvenementsPenal = (typeof typesEvenementsPenal)[number];
|
||||||
export const typesEvenementsPenal = [
|
export const typesEvenementsPenal = [
|
||||||
"Mise en demeure de scolarisation",
|
"Mise en demeure de scolarisation",
|
||||||
|
|
||||||
"Gendarmerie/Forces de l'ordre",
|
"Gendarmerie/Forces de l'ordre",
|
||||||
|
|
||||||
"Réquisition judiciaire",
|
// Procureur
|
||||||
"Audition 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 refusée",
|
||||||
"Composition pénale accepté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",
|
"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;
|
] 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 { mermaidDiagramStatsGeneralesMensuelles } from "./statistiques/v2/generales/mermaidDiagramStatsGeneralesMensuelles";
|
||||||
import { publishStatsGenerales } from "./notion/publish/v2/publishStatsGenerales";
|
import { publishStatsGenerales } from "./notion/publish/v2/publishStatsGenerales";
|
||||||
import { nettoyerDonneesFamilles } from "./data/nettoyage/nettoyerDonneesFamilles";
|
import { nettoyerDonneesFamilles } from "./data/nettoyage/nettoyerDonneesFamilles";
|
||||||
|
import { typeEvenementsProcedurePenale } from "./data/TypeEvenementsPenal";
|
||||||
|
|
||||||
type ProcessOptions = {
|
type ProcessOptions = {
|
||||||
dryRun: boolean;
|
dryRun: boolean;
|
||||||
|
@ -133,11 +134,16 @@ function buildProcessOptions(): ProcessOptions {
|
||||||
console.log("Publishing statistics...");
|
console.log("Publishing statistics...");
|
||||||
await publishStatisticsToNotion(elStats, currentDate, notionClient);
|
await publishStatisticsToNotion(elStats, currentDate, notionClient);
|
||||||
|
|
||||||
const header = `
|
const header = `Notes:
|
||||||
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")}
|
||||||
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(
|
await publishStatsGenerales(
|
||||||
notionClient,
|
notionClient,
|
||||||
header,
|
header,
|
||||||
|
@ -147,7 +153,7 @@ Dernière mise à jour le ${formatDate(currentDate, "dd/MM/yyyy à HH:mm")}
|
||||||
await publishStatsToPage(
|
await publishStatsToPage(
|
||||||
notionClient,
|
notionClient,
|
||||||
"969eac5c-a4eb-49d4-b4ad-c341c9c4c785",
|
"969eac5c-a4eb-49d4-b4ad-c341c9c4c785",
|
||||||
header,
|
headerPenale,
|
||||||
statsPenalesDesc,
|
statsPenalesDesc,
|
||||||
statsPenales
|
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 { Client } from "@notionhq/client";
|
||||||
import { createMermaidCodeBlock } from "../blocks/createMermaidCodeBlock";
|
import { createMermaidCodeBlock } from "../blocks/createMermaidCodeBlock";
|
||||||
import { createParagraphBlock } from "../blocks/createParagraphBlock";
|
|
||||||
import { createStatGroupChildrenListItemBlock } from "./createStatGroupListItemBlock";
|
import { createStatGroupChildrenListItemBlock } from "./createStatGroupListItemBlock";
|
||||||
import { updatePageContent } from "./updatePageContent";
|
import { updatePageContent } from "./updatePageContent";
|
||||||
import {
|
import {
|
||||||
StatsGenerales,
|
StatsGenerales,
|
||||||
statsGeneralesDesc,
|
statsGeneralesDesc,
|
||||||
} from "../../../statistiques/v2/generales/StatsGenerales";
|
} from "../../../statistiques/v2/generales/StatsGenerales";
|
||||||
|
import { createCalloutBlock } from "../blocks/createCalloutBlock";
|
||||||
|
|
||||||
export async function publishStatsGenerales(
|
export async function publishStatsGenerales(
|
||||||
notionClient: Client,
|
notionClient: Client,
|
||||||
|
@ -14,7 +14,7 @@ export async function publishStatsGenerales(
|
||||||
statsGenerales: StatsGenerales,
|
statsGenerales: StatsGenerales,
|
||||||
mermaidDiagramStatsGeneralesMensuelles: string
|
mermaidDiagramStatsGeneralesMensuelles: string
|
||||||
) {
|
) {
|
||||||
const headerBlock = createParagraphBlock(header);
|
const headerBlock = createCalloutBlock(header);
|
||||||
const statsBlocks = createStatGroupChildrenListItemBlock(
|
const statsBlocks = createStatGroupChildrenListItemBlock(
|
||||||
statsGeneralesDesc,
|
statsGeneralesDesc,
|
||||||
statsGenerales
|
statsGenerales
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {
|
||||||
isEvenementBefore,
|
isEvenementBefore,
|
||||||
isProcureur,
|
isProcureur,
|
||||||
isGendarmerie,
|
isGendarmerie,
|
||||||
isProcedurePenale,
|
isEvtProcedurePenale,
|
||||||
EvenementFamille,
|
EvenementFamille,
|
||||||
isProcedurePenaleHorsGendarmerie,
|
isProcedurePenaleHorsGendarmerie,
|
||||||
} from "../../../data/EvenementFamille";
|
} from "../../../data/EvenementFamille";
|
||||||
|
@ -62,7 +62,7 @@ export function computeStatsPenales(familles: Famille[]): StatsPenales {
|
||||||
nbFamillesMisesEnDemeure: famillesMisesEnDemeure.length,
|
nbFamillesMisesEnDemeure: famillesMisesEnDemeure.length,
|
||||||
nbFamillesAvecProcedurePenale: filterFamillesWithOneOfEvenements(
|
nbFamillesAvecProcedurePenale: filterFamillesWithOneOfEvenements(
|
||||||
famillesResistantesOuEx,
|
famillesResistantesOuEx,
|
||||||
isProcedurePenale
|
isEvtProcedurePenale
|
||||||
).length,
|
).length,
|
||||||
nbFamillesAvecGendarmerie: famillesGendarmerie.length,
|
nbFamillesAvecGendarmerie: famillesGendarmerie.length,
|
||||||
nbFamillesAvecGendarmerieSansSuiteACeJour:
|
nbFamillesAvecGendarmerieSansSuiteACeJour:
|
||||||
|
|
Loading…
Reference in New Issue