Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Utilisation de defaultdict pour créer THEMATIQUES_MAPPING_DORA_TO_DI
Browse files Browse the repository at this point in the history
  • Loading branch information
ggounot committed Oct 7, 2024
1 parent 7b4f361 commit 5c4d393
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions dora/data_inclusion/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from collections import defaultdict

# À une thématique DI correspond une thématique Dora
THEMATIQUES_MAPPING_DI_TO_DORA = {
"logement-hebergement--etre-accompagne-dans-son-projet-accession": "logement-hebergement--etre-accompagne-pour-se-loger",
Expand All @@ -7,11 +9,7 @@

# Inversion du dictionnaire
# À une thématique Dora correspond une liste de thématiques DI
THEMATIQUES_MAPPING_DORA_TO_DI = {}
THEMATIQUES_MAPPING_DORA_TO_DI = defaultdict(list)
for key, value in THEMATIQUES_MAPPING_DI_TO_DORA.items():
if value.endswith("--autre"):
continue
if value not in THEMATIQUES_MAPPING_DORA_TO_DI:
THEMATIQUES_MAPPING_DORA_TO_DI[value] = [key]
else:
if not value.endswith("--autre"):
THEMATIQUES_MAPPING_DORA_TO_DI[value].append(key)

0 comments on commit 5c4d393

Please sign in to comment.