def getAccidentsByDate(analyzer, initialDate):
    """
    Retorna los accidentes por fecha y su severidad
    """
    initialDate = datetime.datetime.strptime(initialDate, '%Y-%m-%d')
    dataentry = model.getAccidentsByDate(analyzer, initialDate.date())
    num_accidents = dataentry["num_accidents"]
    severities = dataentry['severityIndex']
    sev1 = model.accidentsSize(model.getSeverity(severities, 1))
    sev2 = model.accidentsSize(model.getSeverity(severities, 2))
    sev3 = model.accidentsSize(model.getSeverity(severities, 3))
    sev4 = model.accidentsSize(model.getSeverity(severities, 4))
    return (num_accidents, sev1, sev2, sev3, sev4)
def getAccidentsByDate(catalog,search_date):
    """
    RETO3 - REQ1
    Llama la función en model que retorna
    el número de accidentes ocurridos en una fecha.
    """    
    search_date = datetime.datetime.strptime(search_date, '%Y-%m-%d')
    year_search_date = str(search_date.year)

#    if year_search_date != '2016' or year_search_date != '2017' or year_search_date != '2018' or year_search_date != '2019':
#        return None

    year_bst = catalog[year_search_date]    
    return model.getAccidentsByDate(year_bst,search_date.date())
예제 #3
0
def getAccidentsByDate(analyzer, accidentDate):
    accidentDate = datetime.datetime.strptime(accidentDate, '%Y-%m-%d')
    return model.getAccidentsByDate(analyzer, accidentDate.date())     
예제 #4
0
def getAccidentsByDate(analyzer, date):
    return model.getAccidentsByDate(analyzer, date)
예제 #5
0
def getAccidentsByDate(analyzer, date):
    """
    Retorna el total de accidentes en una fecha
    """
    date = datetime.datetime.strptime(date, '%Y-%m-%d')
    return model.getAccidentsByDate(analyzer, date.date())
예제 #6
0
def getAccidentsByDate (analizer,date):
    date =  datetime.datetime.strptime(date, '%Y-%m-%d')
    return  model.getAccidentsByDate(analizer,date.date())
예제 #7
0
def getAccidentsByDate(analyzer, date):
    try:
        newDate = datetime.datetime.strptime(date, '%Y-%m-%d')
        return model.getAccidentsByDate(newDate.date(), analyzer)
    except:
        return None