Skip to content

Commit

Permalink
fix: readme & percentage oricertif
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Sep 21, 2023
1 parent bb7ced4 commit 3c6d7b6
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 3 deletions.
73 changes: 72 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Il est maintenant possible de se connecter en utilisant l'adresse email et le mo

## Initialisation de l'environnement ELK

### Indexation des certificats et des utilisateurs
### Indexation des certificats et des utilisateurs (auto avec docker)

```
docker run --net=host --rm -ti -e NODE_TLS_REJECT_UNAUTHORIZED=0 -v ./default-indexes:/tmp --entrypoint multielasticdump elasticdump/elasticsearch-dump \
Expand All @@ -101,6 +101,77 @@ docker run --net=host --rm -ti -e NODE_TLS_REJECT_UNAUTHORIZED=0 -v ./default-in
--tlsAuth
```

### Indexation des certificats (manuelle)

Création de l'index principal destiné à rassembler les informations relatives aux certificats.

Rendez-vous dans "Management" > "Dev Tools" et lancez la requête suivante :

```
PUT /cm2d_certificate
{
"mappings": {
"_meta": {
"created_by": "cm2d-admin"
},
"properties": {
"@timestamp": {
"type": "date"
},
"age": {
"type": "long"
},
"categories_level_1": {
"type": "keyword"
},
"categories_associate": {
"type": "keyword"
},
"nnc": {
"type": "keyword"
},
"date": {
"type": "date",
"format": "iso8601"
},
"death_location": {
"type": "keyword"
},
"department": {
"type": "long"
},
"home_location": {
"type": "keyword"
},
"kind": {
"type": "keyword"
},
"sex": {
"type": "keyword"
}
}
}
}'
```

### Index pour les attributs supplémentaires des utilisateurs (manuelle)

Pour stocker des informations supplémentaires concernant les utilisateurs CM2D, nous devons créer un index dédié.

Rendez-vous dans "Management" > "Dev Tools" et lancez la requête suivante :

```
PUT /cm2d_users
{
"mappings": {
"properties": {
"username": { "type": "text" },
"versionCGU": { "type": "text" }
}
}
}
```

### Mise en place des transformations

En utilisant l'interface ELK, naviguez jusqu'à Stack Management > Transform, et installez les indices de transformation suivants :
Expand Down
21 changes: 20 additions & 1 deletion default-indexes/cm2d_certificate.mapping.json
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
{"cm2d_certificate":{"mappings":{"_meta":{"created_by":"file-data-visualizer"},"properties":{"@timestamp":{"type":"date"},"age":{"type":"long"},"categories_level_1":{"type":"keyword"},"categories_level_2":{"type":"keyword"},"coordinates":{"type":"keyword"},"date":{"type":"date","format":"iso8601"},"death_location":{"type":"keyword"},"department":{"type":"long"},"home_location":{"type":"keyword"},"kind":{"type":"keyword"},"sex":{"type":"keyword"}}}}}
{
"cm2d_certificate": {
"mappings": {
"_meta": { "created_by": "default-index-sample" },
"properties": {
"@timestamp": { "type": "date" },
"age": { "type": "long" },
"categories_level_1": { "type": "keyword" },
"categories_level_2": { "type": "keyword" },
"coordinates": { "type": "keyword" },
"date": { "type": "date", "format": "iso8601" },
"death_location": { "type": "keyword" },
"department": { "type": "long" },
"home_location": { "type": "keyword" },
"kind": { "type": "keyword" },
"sex": { "type": "keyword" }
}
}
}
}
4 changes: 3 additions & 1 deletion webapp-next/pages/bo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ export default function Home() {
);

const electronicPercentage =
((dataKind.result?.aggregations?.aggregated_x?.buckets[0]?.doc_count || 1) /
((dataKind.result?.aggregations?.aggregated_x?.buckets.find(
(_: { doc_count: number; key: string }) => _.key === 'Electronique'
)?.doc_count || 1) /
(dataKind.result?.hits?.total?.value || 1)) *
100;
const total = data.result?.hits?.total?.value || 0;
Expand Down

0 comments on commit 3c6d7b6

Please sign in to comment.