clean presidio
This commit is contained in:
@@ -12,9 +12,135 @@ import { EntityMapping } from "../config/entityLabels";
|
||||
|
||||
interface EntityMappingTableProps {
|
||||
mappings: EntityMapping[];
|
||||
selectedCategory?: string;
|
||||
}
|
||||
|
||||
export const EntityMappingTable = ({ mappings }: EntityMappingTableProps) => {
|
||||
// Fonction pour filtrer les entités selon la catégorie
|
||||
const filterMappingsByCategory = (
|
||||
mappings: EntityMapping[],
|
||||
category: string = "pii_business"
|
||||
): EntityMapping[] => {
|
||||
if (category === "pii_business") {
|
||||
return mappings; // Tout afficher
|
||||
}
|
||||
|
||||
// Définir les entités PII (Données personnelles)
|
||||
const piiEntities = new Set([
|
||||
// Données personnelles de base
|
||||
"PERSONNE",
|
||||
"PERSON",
|
||||
"DATE",
|
||||
"DATE_TIME",
|
||||
"EMAIL_ADDRESS",
|
||||
"ADRESSE_EMAIL",
|
||||
"PHONE_NUMBER",
|
||||
"TELEPHONE",
|
||||
"CREDIT_CARD",
|
||||
"IBAN",
|
||||
"ADRESSE_IP",
|
||||
|
||||
// Adresses personnelles
|
||||
"ADRESSE",
|
||||
"ADRESSE_FRANCAISE",
|
||||
"ADRESSE_BELGE",
|
||||
"LOCATION",
|
||||
|
||||
// Téléphones personnels
|
||||
"TELEPHONE_FRANCAIS",
|
||||
"TELEPHONE_BELGE",
|
||||
|
||||
// Documents d'identité personnels
|
||||
"NUMERO_SECURITE_SOCIALE_FRANCAIS",
|
||||
"REGISTRE_NATIONAL_BELGE",
|
||||
"CARTE_IDENTITE_FRANCAISE",
|
||||
"CARTE_IDENTITE_BELGE",
|
||||
"PASSEPORT_FRANCAIS",
|
||||
"PASSEPORT_BELGE",
|
||||
"PERMIS_CONDUIRE_FRANCAIS",
|
||||
|
||||
// Données financières personnelles
|
||||
"COMPTE_BANCAIRE_FRANCAIS",
|
||||
|
||||
// Données sensibles RGPD
|
||||
"HEALTH_DATA",
|
||||
"DONNEES_SANTE",
|
||||
"SEXUAL_ORIENTATION",
|
||||
"ORIENTATION_SEXUELLE",
|
||||
"POLITICAL_OPINIONS",
|
||||
"OPINIONS_POLITIQUES",
|
||||
"BIOMETRIC_DATA",
|
||||
"DONNEES_BIOMETRIQUES",
|
||||
"RGPD_FINANCIAL_DATA",
|
||||
"DONNEES_FINANCIERES_RGPD",
|
||||
|
||||
// Identifiants personnels
|
||||
"IDENTIFIANT_PERSONNEL",
|
||||
]);
|
||||
|
||||
// Définir les entités Business (Données d'entreprise)
|
||||
const businessEntities = new Set([
|
||||
// Organisations et sociétés
|
||||
"ORGANISATION",
|
||||
"ORGANIZATION",
|
||||
"SOCIETE_FRANCAISE",
|
||||
"SOCIETE_BELGE",
|
||||
|
||||
// Identifiants fiscaux et d'entreprise
|
||||
"TVA_FRANCAISE",
|
||||
"TVA_BELGE",
|
||||
"NUMERO_FISCAL_FRANCAIS",
|
||||
"SIRET_SIREN_FRANCAIS",
|
||||
"NUMERO_ENTREPRISE_BELGE",
|
||||
|
||||
// Identifiants professionnels
|
||||
"ID_PROFESSIONNEL_BELGE",
|
||||
|
||||
// Données commerciales
|
||||
"MARKET_SHARE",
|
||||
"SECRET_COMMERCIAL",
|
||||
"REFERENCE_CONTRAT",
|
||||
"MONTANT_FINANCIER",
|
||||
|
||||
// Données techniques d'entreprise
|
||||
"CLE_API_SECRETE",
|
||||
]);
|
||||
|
||||
// Définir les entités mixtes (PII + Business)
|
||||
const mixedEntities = new Set([
|
||||
// Données pouvant être personnelles ou professionnelles
|
||||
"TITRE_CIVILITE",
|
||||
"DONNEES_PROFESSIONNELLES",
|
||||
"LOCALISATION_GPS",
|
||||
"URL_IDENTIFIANT",
|
||||
]);
|
||||
|
||||
if (category === "pii") {
|
||||
// Inclure PII + mixtes
|
||||
const allowedEntities = new Set([...piiEntities, ...mixedEntities]);
|
||||
return mappings.filter((mapping) =>
|
||||
allowedEntities.has(mapping.entity_type)
|
||||
);
|
||||
}
|
||||
|
||||
if (category === "business") {
|
||||
// Inclure Business + mixtes
|
||||
const allowedEntities = new Set([...businessEntities, ...mixedEntities]);
|
||||
return mappings.filter((mapping) =>
|
||||
allowedEntities.has(mapping.entity_type)
|
||||
);
|
||||
}
|
||||
|
||||
// Par défaut, retourner tous les mappings
|
||||
return mappings;
|
||||
};
|
||||
|
||||
export const EntityMappingTable = ({
|
||||
mappings,
|
||||
selectedCategory = "pii_business",
|
||||
}: EntityMappingTableProps) => {
|
||||
// Filtrer les mappings selon la catégorie sélectionnée
|
||||
const filteredMappings = filterMappingsByCategory(mappings, selectedCategory);
|
||||
|
||||
if (!mappings || mappings.length === 0) {
|
||||
return (
|
||||
<Card className="mt-8">
|
||||
@@ -32,9 +158,37 @@ export const EntityMappingTable = ({ mappings }: EntityMappingTableProps) => {
|
||||
);
|
||||
}
|
||||
|
||||
// Créer un compteur pour chaque type d'entité
|
||||
if (filteredMappings.length === 0) {
|
||||
const categoryNames = {
|
||||
pii: "PII (Données Personnelles)",
|
||||
business: "Business (Données Métier)",
|
||||
pii_business: "PII + Business",
|
||||
};
|
||||
|
||||
return (
|
||||
<Card className="mt-8">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-medium text-[#092727]">
|
||||
Entités détectées -{" "}
|
||||
{categoryNames[selectedCategory as keyof typeof categoryNames] ||
|
||||
"Toutes"}
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-gray-500 text-center py-8">
|
||||
Aucune entité de type "
|
||||
{categoryNames[selectedCategory as keyof typeof categoryNames] ||
|
||||
"sélectionné"}
|
||||
" détectée dans le document.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
// Créer un compteur pour chaque type d'entité (sur les mappings filtrés)
|
||||
const entityCounts: { [key: string]: number } = {};
|
||||
const mappingsWithNumbers = mappings.map((mapping) => {
|
||||
const mappingsWithNumbers = filteredMappings.map((mapping) => {
|
||||
const entityType = mapping.entity_type;
|
||||
entityCounts[entityType] = (entityCounts[entityType] || 0) + 1;
|
||||
return {
|
||||
@@ -44,11 +198,20 @@ export const EntityMappingTable = ({ mappings }: EntityMappingTableProps) => {
|
||||
};
|
||||
});
|
||||
|
||||
const categoryNames = {
|
||||
pii: "PII (Données Personnelles)",
|
||||
business: "Business (Données Métier)",
|
||||
pii_business: "PII + Business",
|
||||
};
|
||||
|
||||
return (
|
||||
<Card className="mt-8">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg font-medium text-[#092727]">
|
||||
Entités détectées ({mappings.length})
|
||||
Entités détectées -{" "}
|
||||
{categoryNames[selectedCategory as keyof typeof categoryNames] ||
|
||||
"Toutes"}{" "}
|
||||
({filteredMappings.length}/{mappings.length})
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
|
||||
Reference in New Issue
Block a user