Skip to content
Snippets Groups Projects
Commit c0fcd16c authored by Remco Tukker's avatar Remco Tukker
Browse files

add funding source data for 2021

parent b0d517c5
Branches
Tags
1 merge request!36add funding source data for 2021
......@@ -40,6 +40,7 @@ def fetch_funding_excel_data():
# select the active worksheet
sheet_name = "2. Income Sources"
ws = wb[sheet_name]
ws2 = wb["Income Sources table"]
def hard_number_convert(s, source_name, nren, year):
if s is None:
......@@ -76,15 +77,15 @@ def fetch_funding_excel_data():
if nren is not None:
yield (nren.upper(), year, client_institution, european_funding, gov_public_bodies, commercial, other)
def create_points_for_year_from_2018(start_row, end_row, year, col_start):
def create_points_for_year_from_2018(sheet, start_row, end_row, year, nren_col, col_start):
for row in range(start_row, end_row):
# extract the data from the row
nren = ws.cell(row=row, column=col_start).value
client_institution = ws.cell(row=row, column=col_start + 3).value
european_funding = ws.cell(row=row, column=col_start + 4).value
gov_public_bodies = ws.cell(row=row, column=col_start + 5).value
commercial = ws.cell(row=row, column=col_start + 6).value
other = ws.cell(row=row, column=col_start + 7).value
nren = sheet.cell(row=row, column=nren_col).value
client_institution = sheet.cell(row=row, column=col_start).value
european_funding = sheet.cell(row=row, column=col_start + 1).value
gov_public_bodies = sheet.cell(row=row, column=col_start + 2).value
commercial = sheet.cell(row=row, column=col_start + 3).value
other = sheet.cell(row=row, column=col_start + 4).value
client_institution = hard_number_convert(client_institution, "client institution", nren, year)
european_funding = hard_number_convert(european_funding, "european funding", nren, year)
......@@ -103,13 +104,16 @@ def fetch_funding_excel_data():
yield from create_points_for_year_until_2017(8, 51, 2017, 32, 35)
# For 2018
yield from create_points_for_year_from_2018(8, 51, 2018, 21)
yield from create_points_for_year_from_2018(ws, 8, 51, 2018, 21, 24)
# For 2019
yield from create_points_for_year_from_2018(8, 51, 2019, 12)
yield from create_points_for_year_from_2018(ws, 8, 51, 2019, 12, 15)
# For 2020
yield from create_points_for_year_from_2018(8, 51, 2020, 3)
yield from create_points_for_year_from_2018(ws, 8, 51, 2020, 3, 6)
# For 2021
yield from create_points_for_year_from_2018(ws2, 8, 51, 2021, 11, 12)
def fetch_charging_structure_excel_data():
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment