<reponame>lrl35/IA_Flood_Warning_System<gh_stars>0
from floodsystem.flood import town_risk
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.datafetcher import fetch_measure_levels
import datetime
from functools import reduce 

def run():
    # Build list of stations
    stations = build_station_list()

    # Update latest level data for all stations
    update_water_levels(stations)

    print("The top 5 staions with highest risks: ", town_risk(stations))
    #print(station_risk(stations[1030]))
    #print(stations[589].latest_level)
    
    #dates, levels = fetch_measure_levels(
        #stations[1030].measure_id, dt=datetime.timedelta(days=2))
    #print(levels)
    
    

if __name__ == "__main__":
    print("*** Task 2G: CUED Part IA Flood Warning System ***")
    run()