Spaces:
Sleeping
Sleeping
[email protected]
commited on
Commit
·
93d8b6e
1
Parent(s):
6236000
Remove CEGARA source
Browse files- data/get_aides_cegara.py +0 -51
- data/importToDb.py +0 -12
data/get_aides_cegara.py
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import requests
|
3 |
-
from datetime import *
|
4 |
-
|
5 |
-
def get_final_type(types):
|
6 |
-
type_mapping = {
|
7 |
-
"Subvention": 2,
|
8 |
-
"Prêt": 1,
|
9 |
-
"Avance récupérable": 1,
|
10 |
-
"Certificat d'économie d'énergie (CEE)": 4,
|
11 |
-
"Autre aide financière": 4,
|
12 |
-
"Ingénierie technique": 4,
|
13 |
-
"Ingénierie financière": 4,
|
14 |
-
"Ingénierie Juridique / administrative": 4
|
15 |
-
}
|
16 |
-
|
17 |
-
final_type_mapping = {
|
18 |
-
1: "Avance − Prêts − Garanties",
|
19 |
-
2: "Subvention",
|
20 |
-
3: "Prise en charge des coûts et allègement des charges",
|
21 |
-
4: "Autres"
|
22 |
-
}
|
23 |
-
|
24 |
-
for t in types:
|
25 |
-
if t in type_mapping:
|
26 |
-
return final_type_mapping[type_mapping[t]]
|
27 |
-
|
28 |
-
return None # Return None if no matching type is found
|
29 |
-
|
30 |
-
|
31 |
-
def request():
|
32 |
-
subventions = requests.get('https://api.groupecegara.fr/aidesliste').json()
|
33 |
-
return subventions
|
34 |
-
|
35 |
-
aides = request()
|
36 |
-
print(f"Nb aides : {len(aides)}")
|
37 |
-
|
38 |
-
for aide in aides:
|
39 |
-
aide["metadata"] = {
|
40 |
-
"type_aide": "Subvention",
|
41 |
-
"lien": f"https://www.groupecegara.fr/publications-flash.html",
|
42 |
-
"Source": f"https://www.groupecegara.fr/publications-flash.html"
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
# print(subventions)
|
47 |
-
# week_number = datetime.today().isocalendar()[1]
|
48 |
-
# filename = 'cegara_sub_' + str(week_number)
|
49 |
-
# with open('{}.json'.format(filename), 'w', encoding='utf-8') as f:
|
50 |
-
with open('data/cegara_sub.json', 'w', encoding='utf-8') as f:
|
51 |
-
json.dump(aides, f, ensure_ascii=False, indent=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/importToDb.py
CHANGED
@@ -80,18 +80,6 @@ def importAideEntreprise(subvention, source):
|
|
80 |
"deadline_date": subvention['submission_deadline'] if 'submission_deadline' in subvention and subvention['submission_deadline'] is not None else -1,
|
81 |
"id_document": f"territoires_{subvention['id']}"
|
82 |
}
|
83 |
-
elif source == "cegara_sub.json":
|
84 |
-
if 'support' in subvention:
|
85 |
-
del subvention['support']
|
86 |
-
if 'html' in subvention:
|
87 |
-
del subvention['html']
|
88 |
-
|
89 |
-
metadata = {
|
90 |
-
**subvention.get("metadata", {}),
|
91 |
-
"id_subvention": subvention['id'],
|
92 |
-
"deadline_date": subvention['validite_fin'] if 'validite_fin' in subvention and subvention['validite_fin'] is not None else -1,
|
93 |
-
"id_document": f"cegara_{subvention['id']}"
|
94 |
-
}
|
95 |
elif source == "les_aides.json":
|
96 |
|
97 |
if 'cci' in subvention:
|
|
|
80 |
"deadline_date": subvention['submission_deadline'] if 'submission_deadline' in subvention and subvention['submission_deadline'] is not None else -1,
|
81 |
"id_document": f"territoires_{subvention['id']}"
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
elif source == "les_aides.json":
|
84 |
|
85 |
if 'cci' in subvention:
|