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())
def getAccidentsByDate(analyzer, accidentDate): accidentDate = datetime.datetime.strptime(accidentDate, '%Y-%m-%d') return model.getAccidentsByDate(analyzer, accidentDate.date())
def getAccidentsByDate(analyzer, date): return model.getAccidentsByDate(analyzer, date)
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())
def getAccidentsByDate (analizer,date): date = datetime.datetime.strptime(date, '%Y-%m-%d') return model.getAccidentsByDate(analizer,date.date())
def getAccidentsByDate(analyzer, date): try: newDate = datetime.datetime.strptime(date, '%Y-%m-%d') return model.getAccidentsByDate(newDate.date(), analyzer) except: return None