import logging


def process_covid_csv_data(covid_csv_data:list) -> tuple:
    """Returns cases in last 7 days, current hospitalisations,
    and total deaths from parsed covid csv data"""

    if not covid_csv_data:
        logging.error("No csv data was inputted")
        return 0, 0, 0

    #Builds a 2D list of the csv data
    for i, row in enumerate(covid_csv_data):
        covid_csv_data[i] = row.split(",")

    #Adds up cases for data entries representing the last 7 days
    cases_last_7 = 0
    for i in range(3, 10):
        cases_last_7 += int(covid_csv_data[i][6])

    current_hospitalisations = int(covid_csv_data[1][5])

    total_deaths = 0
    #Finds the latest data entry with a death count
    i = 1
    while covid_csv_data[i][4] == "":
        i += 1
    total_deaths = int(covid_csv_data[i][4])

    return cases_last_7, current_hospitalisations, total_deaths