if CASES_FILENAME != "" and asm.file_exists(CASES_FILENAME): ctmap = { "Neglect/ Cruelty": 7, "Bite": 5, "Nuisance": 8, "Stray": 3, "wildlife": 3, "Assist Police/Fire": 3, "Feral Cat": 3, "Injured": 10, "TNR": 10 } for d in asm.csv_to_list(CASES_FILENAME): if d["Case ID"] == "Case ID": continue # Ignore repeated headers # Each row contains an animal control incident/case ac = asm.AnimalControl() animalcontrol.append(ac) c = d["Case ID"] ac.CallDateTime = getdatetime(d["Case Date/Time"]) or getdate( d["Case Date/Time"], True) ac.IncidentDateTime = ac.CallDateTime ac.IncidentTypeID = 1 if d["Case Type"] in ctmap: ac.IncidentTypeID = ctmap[d["Case Type"]] ac.DispatchDateTime = ac.CallDateTime ac.CompletedDate = getdatetime(d["Result Date/Time"]) if ac.CompletedDate is None: ac.CompletedDate = ac.CallDateTime ac.AnimalDescription = "%s %s" % (d["Number Of Animals"], d["Animal Description"]) ac.DispatchedACO = d["Case Officer"] ac.DispatchAddress = d["Street Name"]
ownerdonations.append(od) nextownerdonationid += 1 od.OwnerID = o.ID od.AnimalID = o.ExtraID if od.AnimalID == "": od.AnimalID = 0 od.MovementID = 0 od.Date = asm.getdate_mmddyy(row["Date"]) od.Donation = asm.get_currency(row["Paid"]) od.DonationTypeID = 2 od.DonationPaymentID = getpaymentmethod(row["PaidBy"]) for row in asm.csv_to_list(PATH + "complaints.csv", strip=True): if asm.getdate_mmddyy(row["Date"]) is None: continue ac = asm.AnimalControl(nextanimalcontrolid) animalcontrols.append(ac) nextanimalcontrolid += 1 calldate = asm.getdate_mmddyy(row["Date"]) invdate = asm.getdate_mmddyy(row["InvestigationDate"]) if invdate is None: invdate = calldate # Caller details if row["CDLastname"] != "": o = findowner(row["CDFirstname"], row["CDLastname"], row["CDAdd1"]) if o is None: o = asm.Owner(nextownerid) owners.append(o) nextownerid += 1 o.OwnerForeNames = row["CDFirstname"] o.OwnerSurname = row["CDLastname"] if o.OwnerSurname == "": o.OwnerSurname = "(blank)"