File size: 1,583 Bytes
9e693fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# coding: utf-8

# In[21]:


from data_manager import get_data

def classify_actions_rse_IMPACTSCORE(data):
    data, _ = get_data()  # Récupérer les données depuis data_manager.py

    criteria = {
        "Limitation des externalités négatives": [],
        "Partage du pouvoir et de la valeur": [],
        "Stratégie à impact": [],
        "Autres": []
    }

    keywords = {
        "Limitation des externalités négatives":["externalités négatives"],
        "Partage du pouvoir et de la valeur": [],
        "Stratégie à impact": [],
    }

    for record in data:
        action_rse = record.get("action_rse", "").lower()
        company_info = {
            "name": record.get("nom_courant_denomination", "N/A"),
            "action_rse": action_rse,
            "activity": record.get("libelle_section_naf", "N/A"),
            "city": record.get("commune", "N/A")
        }
        found_category = False
        for criterion, key_phrases in keywords.items():
            if any(key_phrase in action_rse for key_phrase in key_phrases):
                criteria[criterion].append(company_info)
                found_category = True
                break  # Assuming each action belongs to one category only
        
        # Si l'action n'a pas été classifiée dans une catégorie existante, la placer dans "Autres"
        if not found_category:
            criteria["Autres"].append(company_info)

    return criteria


# In[22]:


data,_=get_data()


# In[23]:


classify_actions_rse_IMPACTSCORE(data)


# In[ ]:





# In[ ]: