-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
62 lines (52 loc) · 1.83 KB
/
run.py
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
import uhm
import parameters
import pandas as pd
for format in ['excel', 'csv']:
uhm.download(
parameters.get_request_for('Upphandlingar, Bas.Antal anbud'),
f'./data/{format}/number_of_tenders',
format
)
uhm.download(
parameters.get_request_for('Upphandlingar, Bas.Antal kontrakterade anbud*'),
f'./data/{format}/number_of_contracted_tenders_with_suppliers',
format
)
uhm.download(
parameters.get_request_for('Upphandlingar, Bas.Antal upphandlingar'),
f'./data/{format}/number_of_procurements',
format
)
uhm.download(
parameters.get_request_for('Upphandlingar, Innovationstyp.Antal upphandlingar, Innovationstyp'),
f'./data/{format}/number_of_innovation_procurements',
format
)
uhm.download(
parameters.get_request_for('Upphandlingar, Miljötyp.Antal upphandlingar, Miljötyp'),
f'./data/{format}/number_of_environmental_procurements',
format
)
uhm.download(
parameters.get_request_for('Upphandlingar, Socialtyp.Antal upphandlingar, Socialtyp'),
f'./data/{format}/number_of_social_procurements',
format
)
uhm.download(
parameters.get_request_for('Upphandlingar, Bas.Kontrakterat värde'),
f'./data/{format}/contracted_value',
format
)
uhm.download(
parameters.get_request_for('Valfrihetssystem.Antal valfrihetsystem'),
f'./data/{format}/number_of_valfrihetsystem',
format
)
# Fix because one request fails for excel format
filepath = './data/{}/number_of_contracted_tenders_with_suppliers.{}'
df = pd.read_csv(filepath.format('csv', 'csv'))
uhm.save_excel_with_adjusted_columns(
df,
filepath.format('excel', 'xlsx'),
f'{df.columns[-1]}'[:31].replace('*', '')
)