didierkouame commited on
Commit
9e693fe
·
verified ·
1 Parent(s): 351233a

Upload 2 files

Browse files
Files changed (2) hide show
  1. ODD.py +123 -0
  2. impactscore.py +69 -0
ODD.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[1]:
5
+
6
+
7
+ #classifier les actions RSE selon la méthode des 17 critères
8
+ from data_manager import get_data
9
+
10
+ def classify_actions_ODD(data):
11
+ data, _ = get_data() # Récupérer les données depuis data_manager.py
12
+
13
+ criteria = {
14
+ "Pas de pauvreté": [],
15
+ "Faim « Zéro »": [],
16
+ "Bonne santé et bien-être": [],
17
+ "Éducation de qualité": [],
18
+ "Eau propre et assainissement": [],
19
+ "Énergie propre et d'un coût abordable": [],
20
+ "Travail décent et croissance économique": [],
21
+ "Industrie, Innovation et infrastructure":[],
22
+ "Inégalités réduites":[],
23
+ "Villes et communautés durable":[],
24
+ "Consommation et production responsables":[],
25
+ "Lutte contre les changements climatiques":[],
26
+ "Vie aquatique":[],
27
+ "Vie terrestre":[],
28
+ "Paix, justice et institutions efficaces":[],
29
+ "Partenariats pour la réalisation des objectifs":[],
30
+ "Autres": []
31
+ }
32
+
33
+ # Keywords pour les 17 critères
34
+ keywords = {
35
+ "Pas de pauvreté": ["pauvreté"],
36
+ "Faim « Zéro »": ["faim"],
37
+ "Bonne santé et bien-être": ["bonne santé", "santé", "bien-être"],
38
+ "Éducation de qualité": ["éducation de qualité", "éducation"],
39
+ "Eau propre et assainissement": ["eau","eau propre", "propre", "assainissement"],
40
+ "Énergie propre et d'un coût abordable": ["énergie","énergie propre","énergétique" ,"coût abordable"],
41
+ "Travail décent et croissance économique": ["travail", "travail décent", "croissance économique"],
42
+ "Industrie, Innovation et infrastructure":["industrie", "innovation", "innovation et infrastructure"],
43
+ "Inégalités réduites":["inégalités", "inégalités réduites"],
44
+ "Villes et communautés durable":["villes","villes et communautés durable"],
45
+ "Consommation et production responsables":["consommation", "consommation et production responsables"],
46
+ "Lutte contre les changements climatiques":["changements climatiques"],
47
+ "Vie aquatique":["vie aquatique", "milieu aquatique"],
48
+ "Vie terrestre":["vie terrestre"],
49
+ "Paix, justice et institutions efficaces":["paix", "justice", "institutions efficaces"],
50
+ "Partenariats pour la réalisation des objectifs":["partenariats"],
51
+ "Autres": []
52
+
53
+ }
54
+
55
+ for record in data:
56
+ action_rse = record.get("action_rse", "").lower()
57
+ company_info = {
58
+ "name": record.get("nom_courant_denomination", "N/A"),
59
+ "action_rse": action_rse,
60
+ "activity": record.get("libelle_section_naf", "N/A"),
61
+ "city": record.get("commune", "N/A")
62
+ }
63
+ found_category = False
64
+ for criterion, key_phrases in keywords.items():
65
+ if any(key_phrase in action_rse for key_phrase in key_phrases):
66
+ criteria[criterion].append(company_info)
67
+ found_category = True
68
+ break # Assuming each action belongs to one category only
69
+
70
+ # Si l'action n'a pas été classifiée dans une catégorie existante, la placer dans "Autres"
71
+ if not found_category:
72
+ criteria["Autres"].append(company_info)
73
+
74
+ return criteria
75
+
76
+
77
+ # In[4]:
78
+
79
+
80
+ data,_=get_data()
81
+
82
+
83
+ # In[5]:
84
+
85
+
86
+ classify_actions_ODD(data)
87
+
88
+
89
+ # In[119]:
90
+
91
+
92
+
93
+
94
+
95
+ # In[ ]:
96
+
97
+
98
+
99
+
100
+
101
+ # In[ ]:
102
+
103
+
104
+
105
+
106
+
107
+ # In[ ]:
108
+
109
+
110
+
111
+
112
+
113
+ # In[ ]:
114
+
115
+
116
+
117
+
118
+
119
+ # In[ ]:
120
+
121
+
122
+
123
+
impactscore.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[21]:
5
+
6
+
7
+ from data_manager import get_data
8
+
9
+ def classify_actions_rse_IMPACTSCORE(data):
10
+ data, _ = get_data() # Récupérer les données depuis data_manager.py
11
+
12
+ criteria = {
13
+ "Limitation des externalités négatives": [],
14
+ "Partage du pouvoir et de la valeur": [],
15
+ "Stratégie à impact": [],
16
+ "Autres": []
17
+ }
18
+
19
+ keywords = {
20
+ "Limitation des externalités négatives":["externalités négatives"],
21
+ "Partage du pouvoir et de la valeur": [],
22
+ "Stratégie à impact": [],
23
+ }
24
+
25
+ for record in data:
26
+ action_rse = record.get("action_rse", "").lower()
27
+ company_info = {
28
+ "name": record.get("nom_courant_denomination", "N/A"),
29
+ "action_rse": action_rse,
30
+ "activity": record.get("libelle_section_naf", "N/A"),
31
+ "city": record.get("commune", "N/A")
32
+ }
33
+ found_category = False
34
+ for criterion, key_phrases in keywords.items():
35
+ if any(key_phrase in action_rse for key_phrase in key_phrases):
36
+ criteria[criterion].append(company_info)
37
+ found_category = True
38
+ break # Assuming each action belongs to one category only
39
+
40
+ # Si l'action n'a pas été classifiée dans une catégorie existante, la placer dans "Autres"
41
+ if not found_category:
42
+ criteria["Autres"].append(company_info)
43
+
44
+ return criteria
45
+
46
+
47
+ # In[22]:
48
+
49
+
50
+ data,_=get_data()
51
+
52
+
53
+ # In[23]:
54
+
55
+
56
+ classify_actions_rse_IMPACTSCORE(data)
57
+
58
+
59
+ # In[ ]:
60
+
61
+
62
+
63
+
64
+
65
+ # In[ ]:
66
+
67
+
68
+
69
+