Exemplo n.º 1
0
 extradata = ""
 a = asm.Animal()
 ppa[trackid] = a
 a.AnimalName = d["Name"]
 a.AnimalTypeID = gettype(d["Type"])
 a.SpeciesID = getspecies(d["Type"])
 if d["Entry Date"].strip() != "": 
     a.DateBroughtIn = getdate(d["Entry Date"])
 a.Neutuered = d["Spay"].strip() == "Y" and 1 or 0
 a.CombiTested = 1
 a.FLVResult = d["Fel Leuk"].strip() == "Y" and 0 or 1
 extradata += "Rabies: " + d["Rabies"] + "\n"
 extradata += "Origin: " + d["Origin"] + "\n"
 extradata += "Rescue Type: " + d["Rescue Type"] + "\n"
 extradata += "Breed: " + d["Breed"] + " " + d["Breed #2"] + "\n"
 a.BreedID = asm.breed_id_for_name(d["Breed"])
 if d["Breed #2"] != "":
     a.Breed2ID = asm.breed_id_for_name(d["Breed #2"])
     a.CrossBreed = 1
 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 if d["Birthdate"].strip() != "": a.DateOfBirth = getdate(d["Birthdate"])
 extradata += "Impound: " + d["Impound"] + "\n"
 a.IdentichipNumber = d["Microchip"]
 if d["Microchip"].strip() != "": a.Identichipped = 1
 a.TattooNumber = d["Tattoo"]
 if d["Tattoo"].strip() != "": a.Tattoo = 1
 extradata += "Registration: " + d["Registration"] + "\n"
 extradata += "Initial Rescue: " + d["Initial Rescue"] + "\n"
 a.Sex = asm.getsex_mf(d["Sex"])
 a.Size = getsize(d["Size"])
 extradata += "Weight: " + d["Weight"]
Exemplo n.º 2
0
     a.SpeciesID = 1
     a.AnimalTypeID = 10
     a.EntryReasonID = 11
 elif d["SPECIES"] == "Cat":
     # Feline
     a.SpeciesID = 2
     a.EntryReasonID = 11
     a.AnimalTypeID = 12
 else:
     # Other species
     a.SpeciesID = asm.species_id_for_name(d["SPECIES"])
     a.AnimalTypeID = asm.type_id_for_name(d["SPECIES"])
 a.generateCode()
 a.ShortCode = d["ANIMALNO"]
 a.Sex = asm.getsex_mf(d["SEX"])
 a.BreedID = asm.breed_id_for_name(d["BREED1"])
 if d["BREED2"] == "Unspecified":
     a.Breed2ID = a.BreedID
     a.CrossBreed = 0
 else:
     a.CrossBreed = 1
     a.Breed2ID = asm.breed_id_for_name(d["BREED2"])
 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 if d["BREED2"].find("Mix") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
     a.BreedName = asm.breed_name_for_id(a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
 a.BaseColourID = asm.colour_id_for_name(d["COLOR1"])
 a.DateBroughtIn = d["FOUNDDATE"]
 if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
 a.Neutered = asm.iif(d["ALTERED"] == "Yes", 1, 0)
Exemplo n.º 3
0
for row in reader:

    # Not enough data for row
    if row[1].strip() == "": break

    a = asm.Animal(nextid)
    nextid += 1
    comments = ""
    a.ShelterCode = row[CODE]
    a.ShortCode = row[CODE]
    a.AnimalName = row[NAME]
    a.DateOfBirth = getdate(row[DOB])
    a.Sex = getsexmf(row[SEX])
    a.AnimalTypeID = type_id_for_name(row[TYPE])
    a.SpeciesID = asm.species_id_for_name(row[SPECIES])
    a.BreedID = asm.breed_id_for_name(row[BREED])
    if row[CROSSBREED].strip() == "":
        a.Breed2ID = a.BreedID
        a.BreedName = asm.breed_name_for_id(a.BreedID)
        a.CrossBreed = 0
    else:
        a.Breed2ID = asm.breed_id_for_name(row[CROSSBREED])
        a.BreedName = asm.breed_name_for_id(
            a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
        a.CrossBreed = 1
    a.BaseColourID = asm.colour_id_for_name(row[BASE_COLOR], True)
    a.ShelterLocation = location_id_for_name(row[INTERNAL_LOCATION])
    a.Size = size_id_for_name(row[SIZE])
    a.DateBroughtIn = getdate(row[DATE_IN])
    comments += "Original owner: " + row[ORIGINAL_OWNER]
    a.EntryReasonID = reason_id_for_name(row[ENTRY_CATEGORY])
Exemplo n.º 4
0
 a.Neutered = asm.cint(row["FIX"])
 a.Declawed = asm.cint(row["DECLAWED"])
 a.IsNotAvailableForAdoption = 0
 a.ShelterLocation = 1
 a.Sex = asm.getsex_mf(asm.fw(row["GENDER"]))
 a.Size = getsize(asm.fw(row["WEIGHT"]))
 a.BaseColourID = asm.colour_id_for_names(asm.fw(row["FURCOLR1"]), asm.fw(row["FURCOLR2"]))
 a.IdentichipNumber = row["MICROCHIP"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 if len(a.IdentichipNumber) == 8: a.IdentichipNumber = "0" + a.IdentichipNumber
 comments = "Original breed: " + row["BREED1"] + "/" + row["CROSSBREED"] + ", age: " + age
 comments += ",Color: " + asm.fw(row["FURCOLR1"]) + "/" + asm.fw(row["FURCOLR2"])
 comments += ", Coat: " + row["COAT"]
 comments += ", Collar: " + row["COLLRTYP"]
 comments += ", Disposition: " + row["LICENSE"]
 a.BreedID = asm.breed_id_for_name(row["BREED1"])
 a.Breed2ID = a.BreedID
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 if row["PUREBRED"] == "0":
     a.Breed2ID = asm.breed_id_for_name(row["CROSSBREED"])
     if a.Breed2ID == 1: a.Breed2ID = 442
     a.BreedName = "%s / %s" % ( asm.breed_name_for_id(a.BreedID), asm.breed_name_for_id(a.Breed2ID) )
 a.HiddenAnimalDetails = comments
 # They also jammed rabies into VACC
 a.RabiesTag = row["VACC"]
 # If the animal is dead, mark it as such
 if row["LICENSE"] == "DECEASED":
     a.Archived = 1
     a.DeceasedDate = a.DateBroughtIn
 elif row["PERSOWNR"] != "0" and row["PERSOWNR"].strip() != "":
     # Is there an adopter link?
Exemplo n.º 5
0
 a.AnimalTypeID = gettype(row[SPECIES])
 if row[SPECIES] == "Kitten":
     a.SpeciesID = 1
 elif row[SPECIES] == "Puppy":
     a.SpeciesID = 2
 else:
     a.SpeciesID = asm.species_id_for_name(row[SPECIES])
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = strip(row, FORMNUM)
 ob = strip(row, BREEDID)
 a.CrossBreed = 0
 if ob.find("Mix") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
     ob = ob.replace("Mix", "")
 a.BreedID = asm.breed_id_for_name(ob)
 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 a.Sex = getsexmf(row[SEX])
 a.Size = getsize(row[RSIZE])
 a.Neutered = cint(row[SPAYED])
 a.NeuteredDate = getdate(row[SPAYDATE])
 a.DateOfBirth = getdate(row[DOB])
 if a.DateOfBirth is None: 
     a.DateOfBirth = a.DateBroughtIn
 a.BaseColourID = asm.colour_id_for_name(row[RCOLOR])
 a.RabiesTag = row[TAG]
 a.IdentichipNumber = row[MICROCHIP]
 if a.IdentichipNumber.strip() != "": 
     a.Identichipped = 1
     a.IdentichipDate = a.DateBroughtIn
 a.AnimalName = strip(row, PETNAME)
Exemplo n.º 6
0
 a.Neutered = d["Is Pet Altered"] == "Yes" and 1 or 0
 a.IsGoodWithCats = 2
 a.IsGoodWithDogs = 2
 a.IsGoodWithChildren = 2
 a.HouseTrained = asm.iif(d["Housebroken"] == "Yes", 0, 2)
 a.Archived = 0
 a.EntryReasonID = 1
 if d["Intake Type"] == "Born In-House": a.EntryReasonID = 13
 if d["Intake Type"] == "Pet Pulled" or d[
         "Intake Type"] == "Rescue Transfer" or d[
             "Intake Type"] == "Shelter Transfer":
     a.EntryReasonID = 15
 if d["Intake Type"] == "Abandoned" or d[
         "Intake Type"] == "Voluntary Surrender":
     a.EntryReasonID = 11
 a.BreedID = asm.breed_id_for_name(d["Primary Breed"])
 a.Breed2ID = a.BreedID
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 a.CrossBreed = 0
 if d["Mix Breed"].strip() != "":
     a.CrossBreed = 1
     if d["Mix Breed"] == "Unknown Mixed Breed":
         a.Breed2ID = 442
     else:
         a.Breed2ID = asm.breed_id_for_name(d["Mix Breed"])
     if a.Breed2ID == 1: a.Breed2ID = 442
     a.BreedName = "%s / %s" % (asm.breed_name_for_id(
         a.BreedID), asm.breed_name_for_id(a.Breed2ID))
 comments = "Intake type: %s\nStatus: %s\nBreed: %s / %s\nAge: %s\nTemperament: %s" % \
     (d["Intake Type"], d["Status"], d["Primary Breed"], d["Mix Breed"], d["Age"], d["Temperament"])
 a.HiddenAnimalDetails = comments
Exemplo n.º 7
0
    if row[ANIMALID].strip() == "": break

    # Each row contains a new animal
    a = asm.Animal(nextanimalid)
    animals.append(a)
    nextanimalid += 1
    comments = "%s, Species: %s, Breed: %s, Insurance: %s %s %s %s, Weight: %s, WeightHigh: %s, WeightLow: %s, VaccDate: %s %s, StrayLoc: %s" % (
        strip(row, POSTIT), strip(row, SPECIES), strip(
            row, BREED), strip(row, INSURANCE), strip(row, INSURANCENAME),
        strip(row, POLICYNUMBER), strip(row, INSDATEREGISTERED),
        strip(row, WEIGHT), strip(row, WEIGHTHIGH), strip(row, WEIGHTLOW),
        strip(row, VACCDATE), strip(row, VACCDATE2), strip(row, STRAYLOC))
    a.AnimalName = strip(row, PETNAME)
    a.AnimalTypeID = gettype(row[SPECIES])
    a.SpeciesID = getspecies(row[SPECIES], row[BREED])
    a.BreedID = asm.breed_id_for_name(row[BREED])
    a.Breed2ID = a.BreedID
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.BaseColourID = asm.colour_id_for_name(row[COLOUR], True)
    dob = row[DOB]
    if dob.find("/") == -1: dob = row[DATEREGISTERED]
    a.DateOfBirth = getdate(dob)
    a.DateBroughtIn = getdate(row[DATEREGISTERED])
    if a.DateBroughtIn == None:
        a.DateBroughtIn = getdate("2012/12/31")
    a.Sex = getsexmf(row[SEX])
    if row[PETREF].strip() != "":
        a.ShelterCode = str(a.DateBroughtIn.year) + row[PETREF]
        a.ShortCode = row[PETREF]
        a.ExtraID = row[PETREF]
    a.IsNotAvailableForAdoption = 0
Exemplo n.º 8
0
 a.DateBroughtIn = broughtin
 dob = broughtin
 if d["General Age"].find("Baby") != -1:
     dob = asm.subtract_days(asm.today(), 91)
 elif d["General Age"].find("Young") != -1:
     dob = asm.subtract_days(asm.today(), 182)
 elif d["General Age"].find("Adult") != -1:
     dob = asm.subtract_days(asm.today(), 730)
 elif d["General Age"].find("Senior") != -1:
     dob = asm.subtract_days(asm.today(), 2555)
 a.DateOfBirth = dob
 a.EstimatedDOB = 1
 a.Sex = 1
 if d["Sex"].startswith("F"):
     a.Sex = 0
 a.BreedID = asm.breed_id_for_name(d["Primary Breed"], DEFAULT_BREED)
 osecondbreed = ""
 if not d["Mixed"] == "Yes":
     a.Breed2ID = a.BreedID
     a.BreedName = asm.breed_name_for_id(a.BreedID)
     a.CrossBreed = 0
 else:
     a.Breed2ID = a.BreedID
     if "Secondary Breed" in d:
         a.Breed2ID = asm.breed_id_for_name(d["Secondary Breed"],
                                            DEFAULT_BREED)
         osecondbreed = d["Secondary Breed"]
     a.BreedName = asm.breed_name_for_id(
         a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
     a.CrossBreed = 1
 a.BaseColourID = asm.colour_id_for_name(d["Color (General)"])
Exemplo n.º 9
0
 animals.append(a)
 ppa[row["PetId"]] = a
 a.AnimalTypeID = gettype(row["Species"])
 a.SpeciesID = asm.species_id_for_name(row["Species"])
 a.AnimalName = row["Name"]
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.DateOfBirth = getdateage(row["ArrivalDate"], row["Age"], row["Period"])
 if a.DateOfBirth is None: a.DateOfBirth = asm.now()
 a.DateBroughtIn = getdate(row["ArrivalDate"])
 if a.DateBroughtIn is None:
     a.DateBroughtIn = asm.now()
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row["EntryNo"]
 a.RabiesTag = row["DiscNo"]
 a.BreedID = asm.breed_id_for_name(row["Breed"])
 # If we've got the default dog breed with a cat, switch to DSH
 if a.SpeciesID == 2 and a.BreedID == 1: a.BreedID = 261
 if row["Breed"].find("X") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 a.BaseColourID = asm.colour_id_for_name(row["Color"])
 a.AnimalComments = row["Notes"]
 a.IdentichipNumber = row["ChipId"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Neutered = asm.iif(row["Desex"] == "YES", 1, 0)
 a.NeuteredDate = getdate(row["DesexDate"])
 a.HealthProblems = row["VetNotes"]
 a.EntryReasonID = 4
 a.IsNotAvailableForAdoption = 0
Exemplo n.º 10
0
 a.AnimalComments = row["Description"]
 a.Weight = asm.atoi(row["Weight"])
 a.IsNotAvailableForAdoption = 0
 location = asm.find_value(cshelterareas, "sysShelterAreasID", row["sysShelterAreasID"], "ShelterArea")
 pen = asm.find_value(cpens, "sysPensID", row["sysPensID"], "Pen")
 a.ShelterLocation = asm.location_from_db(location, 1)
 a.ShelterLocationUnit = pen
 a.Sex = asm.getsex_mf(asm.find_value(cgenders, "sysGenderChoicesID", row["sysGenderChoicesID"], "GenderChoice"))
 a.Size = 2
 color1 = asm.find_value(ccolors, "sysCoatColorsID", row["ColorPrimaryID"], "Description")
 color2 = asm.find_value(ccolors, "sysCoatColorsID", row["ColorSecondaryID"], "Description")
 a.BaseColourID = asm.colour_id_for_names(asm.fw(color1), asm.fw(color2))
 #a.IdentichipNumber = row["MICROCHIP"]
 breed1 = asm.find_value(cbreeds, "sysBreedsID", row["sysBreedPrimaryID"], "Breed")
 breed2 = asm.find_value(cbreeds, "sysBreedsID", row["sysBreedSecondaryID"], "Breed")
 a.BreedID = asm.breed_id_for_name(breed1)
 a.Breed2ID = asm.breed_id_for_name(breed2)
 # Not sure if this was customer specific with the (Mix) (Purebred) -
 # needs checking on future conversions
 if breed2 == "(Mix)": 
     a.Breed2ID = 442
     a.CrossBreed = 1
     a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 if breed2 == "(Purebred)":
     a.Breed2ID = a.BreedID
     a.CrossBreed = 0
     a.BreedName = asm.breed_name_for_id(a.BreedID)
 status = asm.find_value(canimalstatuses, "sysAnimalStatusChoicesID", row["sysAnimalStatusChoicesID"], "STATUS")
 statusdate = asm.getdate_mmddyy(row["StatusDate"])
 a.ExtraID = statusdate
 a.OnFoster = False
Exemplo n.º 11
0
 a.AnimalName = name
 dob = broughtin
 if age.find("Baby") != -1:
     dob -= datetime.timedelta(days = 91)
 elif age.find("Young") != -1:
     dob -= datetime.timedelta(days = 182)
 elif age.find("Adult") != -1:
     dob -= datetime.timedelta(days = 730)
 elif age.find("Senior") != -1:
     dob -= datetime.timedelta(days = 2555)
 a.DateOfBirth = dob
 a.EstimatedDOB = 1
 a.Sex = 1
 if sex.strip().lower().find("female") != -1:
     a.Sex = 0
 a.BreedID = asm.breed_id_for_name(breed1, DEFAULT_BREED)
 if not crossbreed:
     a.Breed2ID = a.BreedID
     a.BreedName = asm.breed_name_for_id(a.BreedID)
     a.CrossBreed = 0
 else:
     a.Breed2ID = asm.breed_id_for_name(breed2, DEFAULT_BREED)
     a.BreedName = asm.breed_name_for_id(a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
     a.CrossBreed = 1
 a.BaseColourID = asm.colour_id_for_name(color)
 a.ShelterLocation = 1
 a.Size = size_id_for_name(size)
 a.Declawed = declawed and 1 or 0
 a.HasSpecialNeeds = specialneeds and 1 or 0
 a.DateBroughtIn = broughtin
 a.EntryReasonID = 1
Exemplo n.º 12
0
for row in reader:

    # Not enough data for row
    if row[1].strip() == "": break

    a = asm.Animal(nextid)
    nextid += 1
    comments = ""
    a.ShelterCode = row[CODE]
    a.ShortCode = row[CODE]
    a.AnimalName = row[NAME]
    a.DateOfBirth = getdate(row[DOB])
    a.Sex = getsexmf(row[SEX])
    a.AnimalTypeID = type_id_for_name(row[TYPE])
    a.SpeciesID = asm.species_id_for_name(row[SPECIES])
    a.BreedID = asm.breed_id_for_name(row[BREED])
    if row[CROSSBREED].strip() == "":
        a.Breed2ID = a.BreedID
        a.BreedName = asm.breed_name_for_id(a.BreedID)
        a.CrossBreed = 0
    else:
        a.Breed2ID = asm.breed_id_for_name(row[CROSSBREED])
        a.BreedName = asm.breed_name_for_id(a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
        a.CrossBreed = 1
    a.BaseColourID = asm.colour_id_for_name(row[BASE_COLOR], True)
    a.ShelterLocation = location_id_for_name(row[INTERNAL_LOCATION])
    a.Size = size_id_for_name(row[SIZE])
    a.DateBroughtIn = getdate(row[DATE_IN])
    comments += "Original owner: " + row[ORIGINAL_OWNER]
    a.EntryReasonID = reason_id_for_name(row[ENTRY_CATEGORY])
    a.IdentichipNumber = row[MICROCHIP]
Exemplo n.º 13
0
    a.DateBroughtIn = getdateiso(row[ARRIVAL_DATE])
    if a.AnimalTypeID == 43:
        a.generateCode("C")
    else:
        a.generateCode("D")
    if row[ANIMAL_ID].strip() != "":
        a.ShelterCode = row[ANIMAL_ID]
        a.ShortCode = row[ANIMAL_ID]
    a.IsNotAvailableForAdoption = 0
    a.ShelterLocation = 6
    a.Sex = getsexmf(row[GENDER])
    a.Size = getsize(row[SIZE])
    a.BaseColourID = asm.colour_id_for_name(row[COLOR], True)
    comments += ", Original breed: " + row[BREED] + " / " + row[SECONDARY_BREED]
    comments += row[MIXED_BREED] == "TRUE" and " (mixed)" or ""
    a.BreedID = asm.breed_id_for_name(row[BREED])
    if row[SECONDARY_BREED].strip() != "":
        a.Breed2ID = asm.breed_id_for_name(row[SECONDARY_BREED])
        a.BreedName = asm.breed_name_for_id(a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
        a.CrossBreed = 1
    else:
        a.Breed2ID = a.BreedID
        a.BreedName = asm.breed_name_for_id(a.BreedID)
        a.CrossBreed = 0
    a.HiddenAnimalDetails = comments
    a.Archived = 0

ID = 0
ANIMALID = 1
ANIMALNAME = 2
MICROCHIPID = 3
Exemplo n.º 14
0
 a.AnimalName = row[NAME]
 a.DateOfBirth = getdate(row[DOB])
 a.DateBroughtIn = getdate(row[RESCUE_DATE])
 a.generateCode("D")
 a.IsNotAvailableForAdoption = row[NOT_FOR_ADOPTION].find(
     "x") != -1 and 1 or 0
 a.Sex = getsexmf(row[SEX])
 a.BaseColourID = asm.colour_id_for_name(row[COLOR], True)
 comments = "Original breed: " + row[BREED] + ", "
 breed = row[BREED]
 breed = breed.replace(" Mix",
                       "").replace("MIX of",
                                   "").replace("?", "").replace("/", ",")
 breeds = breed.split(",")
 if len(breeds) == 1:
     a.BreedID = asm.breed_id_for_name(breeds[0].strip())
     a.Breed2ID = asm.breed_id_for_name(breeds[0].strip())
     a.BreedName = asm.breed_name_for_id(a.BreedID)
     a.CrossBreed = 0
 elif len(breeds) > 1:
     a.BreedID = asm.breed_id_for_name(breeds[0].strip())
     a.Breed2ID = asm.breed_id_for_name(breeds[1].strip())
     a.BreedName = asm.breed_name_for_id(
         a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
     a.CrossBreed = 1
 else:
     a.BreedID = 1
     a.Breed2ID = 1
     a.BreedName = asm.breed_name_for_id(1)
     a.CrossBreed = 0
 a.AcceptanceNumber = row[LITTER]
Exemplo n.º 15
0
 a.Neutered = asm.cint(row["FIX"])
 a.Declawed = asm.cint(row["DECLAWED"])
 a.IsNotAvailableForAdoption = 0
 a.ShelterLocation = 1
 a.Sex = asm.getsex_mf(asm.strip(row["GENDER"]))
 a.Size = getsize(asm.strip(row["WEIGHT"]))
 a.BaseColourID = asm.colour_id_for_names(asm.strip(row["FURCOLR1"]),
                                          asm.strip(row["FURCOLR2"]))
 a.IdentichipNumber = asm.strip(row["MICROCHIP"])
 comments = "Original breed: " + asm.strip(row["BREED1"]) + "/" + asm.strip(
     row["CROSSBREED"]) + ", age: " + age
 comments += ",Color: " + asm.strip(row["FURCOLR1"]) + "/" + asm.strip(
     row["FURCOLR2"])
 comments += ", Coat: " + asm.strip(row["COAT"])
 comments += ", Collar: " + asm.strip(row["COLLRTYP"])
 a.BreedID = asm.breed_id_for_name(asm.strip(row["BREED1"]))
 a.Breed2ID = a.BreedID
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 if row["PUREBRED"] == "0":
     a.Breed2ID = asm.breed_id_for_name(asm.strip(row["CROSSBREED"]))
     if a.Breed2ID == 1: a.Breed2ID = 442
     a.BreedName = "%s / %s" % (asm.breed_name_for_id(
         a.BreedID), asm.breed_name_for_id(a.Breed2ID))
 a.HiddenAnimalDetails = comments
 # Make everything non-shelter until it's in the shelter file
 a.NonShelterAnimal = 1
 a.Archived = 1
 # If the row has an original owner
 if ppo.has_key(row["PERSOWNR"]):
     o = ppo[row["PERSOWNR"]]
     a.OriginalOwnerID = o.ID
Exemplo n.º 16
0
}

lastbroughtin = None
for d in ccats:
    # Each row contains an animal with intake info and sometimes outcome
    a = asm.Animal()
    animals[d["CatId"]] = a
    a.AnimalName = d["Name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateBroughtIn = asm.getdate_mmddyy(d["IntakeDate"])
    if a.DateBroughtIn is None:
        a.DateBroughtIn = lastbroughtin
    else:
        lastbroughtin = a.DateBroughtIn
    a.BreedID = asm.breed_id_for_name(d["CatBreed"], 261)
    a.BaseColourID = asm.colour_id_for_name(d["CatColor"])
    a.AnimalTypeID = asm.iif(d["OwnerSurrender"] == "1", 11, 12)
    a.SpeciesID = 2
    a.Sex = asm.getsex_mf(d["Sex"])
    a.DateOfBirth = asm.getdate_mmddyy(d["DOB"])
    if a.DateOfBirth is None:
        dy = 365 * asm.cint(d["AgeYrs"])
        dy += 30 * asm.cint(d["AgeMos"])
        dy += 7 * asm.cint(d["AgeWks"])
        dy += asm.cint(d["AgeDays"])
        a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, dy)
    a.Neutered = asm.iif(d["SpayOrNeuteredPreviously"] == "1", 1, 0)
    if a.Neutered == 0:
        a.Neutered = asm.iif(d["Spay/NeuterDate"] != "", 1, 0)
    a.NeuteredDate = asm.getdate_mmddyy(d["Spay/NeuterDate"])
Exemplo n.º 17
0
}

lastbroughtin = None
for d in ccats:
    # Each row contains an animal with intake info and sometimes outcome
    a = asm.Animal()
    animals[d["CatId"]] = a
    a.AnimalName = d["Name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateBroughtIn = asm.getdate_mmddyy(d["IntakeDate"])
    if a.DateBroughtIn is None:
        a.DateBroughtIn = lastbroughtin
    else:
        lastbroughtin = a.DateBroughtIn
    a.BreedID = asm.breed_id_for_name(d["CatBreed"], 261)
    a.BaseColourID = asm.colour_id_for_name(d["CatColor"])
    a.AnimalTypeID = asm.iif(d["OwnerSurrender"] == "1", 11, 12)
    a.SpeciesID = 2
    a.Sex = asm.getsex_mf(d["Sex"])
    a.DateOfBirth = asm.getdate_mmddyy(d["DOB"])
    if a.DateOfBirth is None:
        dy = 365 * asm.cint(d["AgeYrs"])
        dy += 30 * asm.cint(d["AgeMos"])
        dy += 7 * asm.cint(d["AgeWks"])
        dy += asm.cint(d["AgeDays"])
        a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, dy)
    a.Neutered = asm.iif(d["SpayOrNeuteredPreviously"] == "1", 1, 0)
    if a.Neutered == 0:
        a.Neutered = asm.iif(d["Spay/NeuterDate"] != "", 1, 0)
    a.NeuteredDate = asm.getdate_mmddyy(d["Spay/NeuterDate"])
Exemplo n.º 18
0
def getbreedsp(cat, typ, breed):
    breed = breed.lower()
    typ = typ.lower()
    cat = cat.lower()
    if cat == "cat":
        speciesid = 2
        breedmap = {
            "dsh": 261,
            "d s h": 261,
            "s h d": 261,
            "d l h": 243,
            "dlh" : 243,
            "dmh" : 252,
            "slh" : 252,
            "s l h": 252,
            "burmese": 232,
            "persian": 287,
            "oriental": 286,
            "siamese": 294,
            "burman": 228,
            "birman": 228
        }
        for k, v in breedmap.iteritems():
            if breed.find(k) != -1:
                breedid = v
                return (speciesid, breedid)
        return (speciesid, 261)
    if cat == "dog":
        speciesid = 1
        breedmap = {
            "staf": 196,
            "sbt": 196,
            "s b t": 196,
            "lurcher": 443,
            "collie": 34,
            "saluki": 174,
            "gsd": 92,
            "rotti": 173,
            "russ": 114,
            "jrt": 114,
            "dane": 98,
            "lab": 125,
            "patter": 152,
            "mastif": 134,
            "shih": 188,
            "sharpei": 183, 
            "spaniel": 194
        }
        for k, v in breedmap.iteritems():
            if breed.find(k) != -1:
                breedid = v
                return (speciesid, breedid)
        return (speciesid, asm.breed_id_for_name(breed, NO_BREED_ID))
    if cat == "other":
        breespmap = {
            "rabbit": (7, 321),
            "budgie": (3, 401),
            "cockatiel": (3, 405),
            "cockateil": (3, 405),
            "chipmunk": (24, 382),
            "guinea pig": (24, 382),
            "g. pig": (24, 382),
            "g/pig": (24, 382),
            "hamster": (24, 383),
            "dove": (3, 408),
            "polecat": (24, 380),
            "ferret": (24, 380),
            "rat": (24, 387),
            "lop": (7, 343),
            "hare": (7, 321),
            "mouse": (24, 385),
            "pigeon": (3, 426),
            "canary": (3, 403),
            "finch": (3, 412),
            "hedgehog": (24, 384),
            "tortoise": (25, 1)
        }
        for k, v in breespmap.iteritems():
            if breed.find(k) != -1 or typ.find(k) != -1:
                speciesid = v[0]
                breedid = v[1]
                return (speciesid, breedid)
        # small and furry, unable to match
        return (24, 445)
    return (2, 261)
Exemplo n.º 19
0
    a.DateBroughtIn = getdateiso(row[ARRIVAL_DATE])
    if a.AnimalTypeID == 43:
        a.generateCode("C")
    else:
        a.generateCode("D")
    if row[ANIMAL_ID].strip() != "":
        a.ShelterCode = row[ANIMAL_ID]
        a.ShortCode = row[ANIMAL_ID]
    a.IsNotAvailableForAdoption = 0
    a.ShelterLocation = 6
    a.Sex = getsexmf(row[GENDER])
    a.Size = getsize(row[SIZE])
    a.BaseColourID = asm.colour_id_for_name(row[COLOR], True)
    comments += ", Original breed: " + row[BREED] + " / " + row[SECONDARY_BREED]
    comments += row[MIXED_BREED] == "TRUE" and " (mixed)" or ""
    a.BreedID = asm.breed_id_for_name(row[BREED])
    if row[SECONDARY_BREED].strip() != "":
        a.Breed2ID = asm.breed_id_for_name(row[SECONDARY_BREED])
        a.BreedName = asm.breed_name_for_id(
            a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
        a.CrossBreed = 1
    else:
        a.Breed2ID = a.BreedID
        a.BreedName = asm.breed_name_for_id(a.BreedID)
        a.CrossBreed = 0
    a.HiddenAnimalDetails = comments
    a.Archived = 0

ID = 0
ANIMALID = 1
ANIMALNAME = 2
Exemplo n.º 20
0
for row in asm.csv_to_list(PATH + "animals.csv", remove_non_ascii=True):
    if row["name"] is None: continue
    if row["code"] is None or row["code"] == "": continue
    if row["primary breed"] is None or row["primary breed"] == "": continue
    if row["species"] is None or row["species"] == "": continue
    if row["primary color"] is None or row["primary color"] == "": continue
    a = asm.Animal()
    animals.append(a)
    ppa[row["id"]] = a
    a.AnimalName = row["name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.ShortCode = row["code"]
    a.AnimalTypeID = asm.type_id_for_name(row["species"])
    a.SpeciesID = asm.species_id_for_name(row["species"])
    a.BreedID = asm.breed_id_for_name(row["primary breed"])
    a.Breed2ID = asm.breed_id_for_name(row["secondary breed"])
    a.CrossBreed = asm.iif(row["secondary breed"] != "", 1, 0)
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.BaseColourID = asm.colour_id_for_name(row["primary color"])
    a.Sex = asm.getsex_mf(row["sex"])
    a.DateBroughtIn = asm.getdate_iso(row["time entered"])
    if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
    a.DateOfBirth = asm.getdate_iso(row["birth date"])
    if a.DateOfBirth is None:
        a.DateOfBirth = asm.getdate_iso(row["time entered"])
    if a.DateOfBirth is None: a.DateOfBirth = a.DateBroughtIn
    a.NeuteredDate = asm.getdate_iso(row["neutered/spayed date"])
    if a.NeuteredDate is not None: a.Neutered = 1
    a.Archived = 0
    a.IdentichipNumber = row["microchip #"]
Exemplo n.º 21
0
 a.AnimalTypeID = gettype(row["SPECIES"])
 if row["SPECIES"] == "Kitten":
     a.SpeciesID = 1
 elif row["SPECIES"] == "Puppy":
     a.SpeciesID = 2
 else:
     a.SpeciesID = asm.species_id_for_name(row["SPECIES"])
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row["FORMNUM"]
 ob = row["BREEDID"]
 a.CrossBreed = 0
 if ob.find("Mix") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
     ob = ob.replace("Mix", "")
 a.BreedID = asm.breed_id_for_name(ob)
 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 a.Sex = asm.getsex_mf(row["SEX"])
 a.Size = getsize(row["RSize"])
 a.Neutered = asm.cint(row["SPAYED"])
 a.NeuteredDate = asm.getdate_mmddyy(row["SPAYDATE"])
 a.DateOfBirth = asm.getdate_mmddyy(row["DOB"])
 if a.DateOfBirth is None: 
     a.DateOfBirth = a.DateBroughtIn
 a.BaseColourID = asm.colour_id_for_name(row["RColor"])
 a.RabiesTag = row["TAG"]
 a.IdentichipNumber = row["MICROCHIP"]
 if a.IdentichipNumber.strip() != "": 
     a.Identichipped = 1
     a.IdentichipDate = a.DateBroughtIn
 a.AnimalName = row["PETNAME"]
Exemplo n.º 22
0
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.DateOfBirth = asm.getdate_yyyymmdd(ca["DOB"])
 if a.DateOfBirth is None:
     a.DateOfBirth = asm.getdate_iso(ca["dateEntered"])
 a.EstimatedDOB = ca["DOBisActual"] == "0" and 1 or 0
 a.Sex = 1
 if ca["sex"] == "F": a.Sex = 0
 a.Neutered = 1
 if ca["altered"] == "U": a.Neuteured = 0
 # Find the breed
 if ca["animalType"] == "C":
     b = findin(cacat, "animalID", ca["animalID"], "felineBreedLUID")
     b = findin(clucat, "luid", b, "hoverText")
     if b != "":
         a.BreedID = asm.breed_id_for_name(b)
         a.BreedName = asm.breed_name_for_id(a.BreedID)
 elif ca["animalType"] == "D":
     b1 = findin(cadog, "animalID", ca["animalID"], "canineBreed1LUID")
     b2 = findin(cadog, "animalID", ca["animalID"], "canineBreed2LUID")
     b1n = findin(cludog, "luid", b1, "hoverText")
     if b2 != "":
         b2n = findin(cludog, "luid", b2, "hoverText")
         a.BreedID = asm.breed_id_for_name(b1n)
         a.Breed2ID = asm.breed_id_for_name(b2n)
         a.CrossBreed = 1
         a.BreedName = asm.breed_name_for_id(
             a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
         a.HiddenAnimalDetails = "breed: %s / %s" % (b1n, b2n)
     else:
         a.BreedID = asm.breed_id_for_name(b1n)
Exemplo n.º 23
0
 elif d["SPECIES"] == "F":
     # Feline
     a.SpeciesID = 2
     if d["SURR_CODE"] == "STR":
         a.EntryReasonID = 11
         a.AnimalTypeID = 12
     else:
         a.AnimalTypeID = 11
 if d["SURR_ID"] != "":
     if ppo.has_key(d["SURR_ID"]):
         a.OriginalOwnerID = ppo[d["SURR_ID"]].ID
 a.generateCode()
 a.ShortCode = d["ID_NUM"]
 a.Sex = asm.getsex_mf(d["SEX"])
 a.ShelterLocationUnit = d["LOCATION"]
 a.BreedID = asm.breed_id_for_name(d["BREED"])
 a.BaseColourID = asm.colour_id_for_name(d["COLOR"])
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 if d["BREED"].find("MIX") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
     a.BreedName = asm.breed_name_for_id(a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
 a.DateBroughtIn = d["DATE_SURR"]
 if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
 a.NeuteredDate = d["NEUTER_DAT"]
 if a.NeuteredDate is not None:
     a.Neutered = 1
 a.EstimatedDOB = 1
 dob = a.DateBroughtIn
 if d["AGE"] != "":
     if d["AGE"].find("YR") != -1:
Exemplo n.º 24
0
def getbreedsp(cat, typ, breed):
    breed = breed.lower()
    typ = typ.lower()
    cat = cat.lower()
    if cat == "cat":
        speciesid = 2
        breedmap = {
            "dsh": 261,
            "d s h": 261,
            "s h d": 261,
            "d l h": 243,
            "dlh": 243,
            "dmh": 252,
            "slh": 252,
            "s l h": 252,
            "burmese": 232,
            "persian": 287,
            "oriental": 286,
            "siamese": 294,
            "burman": 228,
            "birman": 228
        }
        for k, v in breedmap.iteritems():
            if breed.find(k) != -1:
                breedid = v
                return (speciesid, breedid)
        return (speciesid, 261)
    if cat == "dog":
        speciesid = 1
        breedmap = {
            "staf": 196,
            "sbt": 196,
            "s b t": 196,
            "lurcher": 443,
            "collie": 34,
            "saluki": 174,
            "gsd": 92,
            "rotti": 173,
            "russ": 114,
            "jrt": 114,
            "dane": 98,
            "lab": 125,
            "patter": 152,
            "mastif": 134,
            "shih": 188,
            "sharpei": 183,
            "spaniel": 194
        }
        for k, v in breedmap.iteritems():
            if breed.find(k) != -1:
                breedid = v
                return (speciesid, breedid)
        return (speciesid, asm.breed_id_for_name(breed, NO_BREED_ID))
    if cat == "other":
        breespmap = {
            "rabbit": (7, 321),
            "budgie": (3, 401),
            "cockatiel": (3, 405),
            "cockateil": (3, 405),
            "chipmunk": (24, 382),
            "guinea pig": (24, 382),
            "g. pig": (24, 382),
            "g/pig": (24, 382),
            "hamster": (24, 383),
            "dove": (3, 408),
            "polecat": (24, 380),
            "ferret": (24, 380),
            "rat": (24, 387),
            "lop": (7, 343),
            "hare": (7, 321),
            "mouse": (24, 385),
            "pigeon": (3, 426),
            "canary": (3, 403),
            "finch": (3, 412),
            "hedgehog": (24, 384),
            "tortoise": (25, 1)
        }
        for k, v in breespmap.iteritems():
            if breed.find(k) != -1 or typ.find(k) != -1:
                speciesid = v[0]
                breedid = v[1]
                return (speciesid, breedid)
        # small and furry, unable to match
        return (24, 445)
    return (2, 261)
Exemplo n.º 25
0
 typecol = ""
 breedcol = ""
 breed2col = ""
 if row.has_key("type"):
     typecol = row["type"]
     breedcol = row["breed"]
     breed2col = row["secondBreed"]
 else:
     # We're going to have to look them up from the speciesID and
     # secondarySpeciesID fields
     typecol = getsbtypenamefromspeciesid(row["speciesID"])
     breedcol = getsbbreednamefromspeciesid(row["speciesID"])
     breed2col = getsbbreednamefromspeciesid(row["secondarySpeciesID"])
 a.AnimalTypeID = asm.type_id_for_name(typecol)
 a.SpeciesID = asm.species_id_for_name(typecol)
 a.BreedID = asm.breed_id_for_name(breedcol)
 a.Breed2ID = asm.breed_id_for_name(breed2col)
 if row["DateIN"].strip() != "":
     a.DateBroughtIn = getdate(row["DateIN"])
     if a.DateBroughtIn is None:
         a.DateBroughtIn = getdate(row["AddDateTime"])
         if a.DateBroughtIn is None:
             a.DateBroughtIn = asm.now()
 if row["DateOUT"].strip() != "":
     a.ActiveMovementDate = getdate(row["DateOUT"])
     if a.ActiveMovementDate is not None:
         a.ActiveMovementType = 1
         a.Archived = 1
     elif a.DateBroughtIn.year < asm.now().year - 1:
         a.Archived = 1
 a.Neutered = row["desexdate"].strip() != "" and 1 or 0
Exemplo n.º 26
0
 a.AnimalName = name
 dob = broughtin
 if age.find("Baby") != -1:
     dob -= datetime.timedelta(days=91)
 elif age.find("Young") != -1:
     dob -= datetime.timedelta(days=182)
 elif age.find("Adult") != -1:
     dob -= datetime.timedelta(days=730)
 elif age.find("Senior") != -1:
     dob -= datetime.timedelta(days=2555)
 a.DateOfBirth = dob
 a.EstimatedDOB = 1
 a.Sex = 1
 if sex.strip().lower().find("female") != -1:
     a.Sex = 0
 a.BreedID = asm.breed_id_for_name(breed1, DEFAULT_BREED)
 if not crossbreed:
     a.Breed2ID = a.BreedID
     a.BreedName = asm.breed_name_for_id(a.BreedID)
     a.CrossBreed = 0
 else:
     a.Breed2ID = asm.breed_id_for_name(breed2, DEFAULT_BREED)
     a.BreedName = asm.breed_name_for_id(
         a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
     a.CrossBreed = 1
 a.BaseColourID = asm.colour_id_for_name(color)
 a.ShelterLocation = 1
 a.Size = size_id_for_name(size)
 a.Declawed = declawed and 1 or 0
 a.HasSpecialNeeds = specialneeds and 1 or 0
 a.DateBroughtIn = broughtin
Exemplo n.º 27
0
 elif d["SPECIES"] == "F":
     # Feline
     a.SpeciesID = 2
     if d["SURR_CODE"] == "STR":
         a.EntryReasonID = 11
         a.AnimalTypeID = 12
     else:
         a.AnimalTypeID = 11
 if d["SURR_ID"] != "":
     if ppo.has_key(d["SURR_ID"]):
         a.OriginalOwnerID = ppo[d["SURR_ID"]].ID
 a.generateCode()
 a.ShortCode = d["ID_NUM"]
 a.Sex = asm.getsex_mf(d["SEX"])
 a.ShelterLocationUnit = d["LOCATION"]
 a.BreedID = asm.breed_id_for_name(d["BREED"])
 a.BaseColourID = asm.colour_id_for_name(d["COLOR"])
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 if d["BREED"].find("MIX") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
     a.BreedName = asm.breed_name_for_id(
         a.BreedID) + " / " + asm.breed_name_for_id(a.Breed2ID)
 a.DateBroughtIn = d["DATE_SURR"]
 if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
 a.NeuteredDate = d["NEUTER_DAT"]
 if a.NeuteredDate is not None:
     a.Neutered = 1
 a.EstimatedDOB = 1
 dob = a.DateBroughtIn
 if d["AGE"] != "":
Exemplo n.º 28
0
    if types.find("Employee") != -1: o.IsStaff = 1
    if types.find("Member") != -1: o.IsMember = 1
    if types.find("Foster") != -1: o.IsFosterer = 1

# animals.csv
for row in asm.csv_to_list(PATH + "animals.csv"):
    a = asm.Animal()
    animals.append(a)
    ppa[row["id"]] = a
    a.AnimalName = row["name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.ShortCode = row["code"]
    a.AnimalTypeID = asm.type_id_for_name(row["species"])
    a.SpeciesID = asm.species_id_for_name(row["species"])
    a.BreedID = asm.breed_id_for_name(row["primary breed"])
    a.Breed2ID = asm.breed_id_for_name(row["secondary breed"])
    a.CrossBreed = asm.iif(row["secondary breed"] != "", 1, 0)
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.BaseColourID = asm.colour_id_for_name(row["primary color"])
    a.Sex = asm.getsex_mf(row["sex"])
    a.DateBroughtIn = asm.getdate_iso(row["time entered"])
    a.DateOfBirth = asm.getdate_iso(row["birth date"])
    if a.DateOfBirth is None: a.DateOfBirth = asm.getdate_iso(row["time entered"])
    a.NeuteredDate = asm.getdate_iso(row["neutered/spayed date"])
    if a.NeuteredDate is not None: a.Neutered = 1
    a.Archived = 0
    a.IdentichipNumber = row["microchip #"]
    if a.IdentichipNumber != "": a.Identichipped = 1
    a.HiddenAnimalDetails = "Original Breed: %s/%s, Color: %s\n%s" % (row["primary breed"], row["secondary breed"], row["primary color"], row["hidden comments"])
    a.AnimalComments = row["general comments"]
Exemplo n.º 29
0
 animals.append(a)
 ppa[row["PetId"]] = a
 a.AnimalTypeID = gettype(row["Species"])
 a.SpeciesID = asm.species_id_for_name(row["Species"])
 a.AnimalName = row["Name"]
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.DateOfBirth = getdateage(row["ArrivalDate"], row["Age"], row["Period"])
 if a.DateOfBirth is None: a.DateOfBirth = asm.now()
 a.DateBroughtIn = getdate(row["ArrivalDate"])
 if a.DateBroughtIn is None:
     a.DateBroughtIn = asm.now()
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row["EntryNo"]
 a.RabiesTag = row["DiscNo"]
 a.BreedID = asm.breed_id_for_name(row["Breed"])
 # If we've got the default dog breed with a cat, switch to DSH
 if a.SpeciesID == 2 and a.BreedID == 1: a.BreedID = 261
 if row["Breed"].find("X") != -1:
     a.CrossBreed = 1
     a.Breed2ID = 442
 a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 a.BaseColourID = asm.colour_id_for_name(row["Color"])
 a.AnimalComments = row["Notes"]
 a.IdentichipNumber = row["ChipId"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Neutered = asm.iif(row["Desex"] == "YES", 1, 0)
 a.NeuteredDate = getdate(row["DesexDate"])
 a.HealthProblems = row["VetNotes"]
 a.EntryReasonID = 4
 a.IsNotAvailableForAdoption = 0
Exemplo n.º 30
0
    a.AnimalTypeID = gettype(row[SPECIES])
    a.generateCode(gettypeletter(a.AnimalTypeID))
    if strip(row, SPECIES) == "Canine":
        a.SpeciesID = 1
    elif strip(row, SPECIES) == "Feline":
        a.SpeciesID = 2
    else:
        a.SpeciesID = asm.species_id_for_name(row[SPECIES])
    ob = strip(row, TYPE)
    if ob.endswith("X"):
        a.Breed2ID = 442
    elif ob.find(" X") != -1:
        obs = ob.split("X")
        if len(obs) == 2:
            a.BreedID = asm.breed_id_for_name(obs[0])
            a.Breed2ID = asm.breed_id_for_name(obs[1])
        else:
            a.BreedID = asm.breed_id_for_name(ob)
    else:
        a.BreedID = asm.breed_id_for_name(ob)
    a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
    a.Sex = getsexmf(row[SEX])
    a.BaseColourID = asm.customcolour_id_for_name(
        strip(row, COLOUR).replace("&", "and"), True)
    a.RabiesTag = row[TAG_NO]
    a.TattooNumber = row[TATOO]
    a.IdentichipNumber = row[CHIP]
    if a.TattooNumber.strip() != "":
        a.Tattoo = 1
        a.TattooDate = a.DateBroughtIn
Exemplo n.º 31
0
 a.DateBroughtIn = getdate(row[GUEST_PIN_INTAKE_DATE])
 if a.DateBroughtIn is None:
     a.DateBroughtIn = datetime.datetime.today()    
 a.SpeciesID = getspecies(row[GUEST_DOG])
 a.AnimalTypeID = gettype(row[GUEST_DOG])
 a.AnimalName = row[GUEST_SHELTER_GUEST_NAME]
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row[GUEST_PIN_ID]
 a.Sex = getsexmf(row[GUEST_MALE])
 breed = row[GUEST_BREED]
 if breed.find("MIX") != -1:
     a.CrossBreed = 1
     breed = breed.replace("MIX", "")
     a.BreedID = asm.breed_id_for_name(breed)
     a.Breed2ID = 442
     a.BreedName = asm.breed_name_for_id(a.BreedID) + " / Crossbreed"
 else:
     a.BreedID = asm.breed_id_for_name(breed)
     a.BreedName = asm.breed_name_for_id(a.BreedID)
 a.DateOfBirth = getdateage(row[GUEST_AGE], row[GUEST_PIN_INTAKE_DATE])
 a.EstimatedDOB = 1
 a.BaseColourID = asm.colour_id_for_name(row[GUEST_COLOR])
 a.IdentichipNumber = row[GUEST_MICROCHIP__]
 if a.IdentichipNumber.strip() != "": a.Identichipped = 1
 a.IdentichipDate = a.DateBroughtIn
 a.RabiesTag = row[ADOPT_RABIES_TAG__]
 a.EntryReasonID = 1
 a.IsNotAvailableForAdoption = 0
 a.ShelterLocation = 1
Exemplo n.º 32
0
 a.ShelterLocationUnit = pen
 a.Sex = asm.getsex_mf(
     asm.find_value(cgenders, "sysGenderChoicesID",
                    row["sysGenderChoicesID"], "GenderChoice"))
 a.Size = 2
 color1 = asm.find_value(ccolors, "sysCoatColorsID", row["ColorPrimaryID"],
                         "Description")
 color2 = asm.find_value(ccolors, "sysCoatColorsID",
                         row["ColorSecondaryID"], "Description")
 a.BaseColourID = asm.colour_id_for_names(asm.fw(color1), asm.fw(color2))
 #a.IdentichipNumber = row["MICROCHIP"]
 breed1 = asm.find_value(cbreeds, "sysBreedsID", row["sysBreedPrimaryID"],
                         "Breed")
 breed2 = asm.find_value(cbreeds, "sysBreedsID", row["sysBreedSecondaryID"],
                         "Breed")
 a.BreedID = asm.breed_id_for_name(breed1)
 a.Breed2ID = asm.breed_id_for_name(breed2)
 # Not sure if this was customer specific with the (Mix) (Purebred) -
 # needs checking on future conversions.
 # It wasn't customer specific - present in last multiops we saw.
 if breed2 == "(Mix)":
     a.Breed2ID = 442
     a.CrossBreed = 1
     a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
 if breed2 == "(Purebred)":
     a.Breed2ID = a.BreedID
     a.CrossBreed = 0
     a.BreedName = asm.breed_name_for_id(a.BreedID)
 status = asm.find_value(canimalstatuses, "sysAnimalStatusChoicesID",
                         row["sysAnimalStatusChoicesID"], "STATUS")
 statusdate = asm.getdate_mmddyy(row["StatusDate"])
 if row["ANIMALUID"] in ppa:
     a = ppa[row["ANIMALUID"]]
 else:
     a = asm.Animal()
     animals.append(a)
     ppa[row["ANIMALUID"]] = a
 a.SpeciesID = asm.species_id_for_name(row["SPECIES"])
 if a.SpeciesID == 1 and row["INTAKE"].startswith("Stray"):
     a.AnimalTypeID = 10
 elif a.SpeciesID == 1:
     a.AnimalTypeID = 2
 elif a.SpeciesID == 2 and row["INTAKE"].startswith("Stray"):
     a.AnimalTypeID = 12
 else:
     a.AnimalTypeID = 11
 a.BreedID = asm.breed_id_for_name(row["PRIMARY BREED"])
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 a.Sex = asm.getsex_mf(row["SEX"])
 a.CrossBreed = 0
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row["ANIMALUID"]
 a.AnimalName = row["NAME"]
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.DateOfBirth = getdate(row["BIRTHDATE"])
 a.DateBroughtIn = getdate(row["INTAKETS"])
 if a.DateBroughtIn is None:
     a.DateBroughtIn = datetime.datetime.today()
 a.LastChangedDate = a.DateBroughtIn
 a.CreatedDate = a.DateBroughtIn
 a.Neutered = row["ALTERED"] == "Y" and 1 or 0
Exemplo n.º 34
0
    nextanimalid += 1
    a.AnimalTypeID = gettype(row[TYPE])
    a.SpeciesID = asm.species_id_for_name(row[TYPE])
    a.AnimalName = row[NAME]
    a.DateOfBirth = getdateage(row[AGE], row[ADOPTION_DATE])
    a.DateBroughtIn = getdate(row[RESCUE_DATE])
    if a.DateBroughtIn == None: a.DateBroughtIn = getdate(row[ADOPTION_DATE])
    if a.DateBroughtIn == None: a.DateBroughtIn = getdate("2012/12/01")
    a.generateCode(gettypeletter(a.AnimalTypeID))
    a.IsNotAvailableForAdoption = 0
    a.ShelterLocation = 1
    a.Sex = getsexmf(row[SEX])
    a.Size = getsize(row[SIZE])
    a.BaseColourID = asm.colour_id_for_name(row[COLOUR], True)
    comments = "Original breed: " + row[BREED] + ", original sex: " + row[SEX] + ", original age: " + row[AGE]
    a.BreedID = asm.breed_id_for_name(row[BREED])
    a.Breed2ID = a.BreedID
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.IdentichipNumber = row[CHIP_NUMBER]
    a.TattooNumber = row[PASSPORT_NO]
    comments += ", Passport: " + row[PASSPORT_NAME] + " " + row[PASSPORT_NO]
    a.HiddenAnimalDetails = comments
    a.Archived = 1

    o = asm.Owner(nextownerid)
    owners.append(o)
    nextownerid += 1
    o.OwnerTitle = row[TITLE]
    o.OwnerForeNames = row[FIRST_NAME]
    o.OwnerSurname = row[SURNAME]
    o.OwnerName = o.OwnerTitle + " " + o.OwnerForeNames + " " + o.OwnerSurname
Exemplo n.º 35
0
    a.AnimalTypeID = 11
    if a.SpeciesID == 1: a.AnimalTypeID = 2  # dog
    if a.SpeciesID == 2: a.AnimalTypeID = 11  # unwanted cat
    a.AnimalName = d["Name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateBroughtIn = getdate(d["Date In"]) or asm.today()
    if d["DOB"].strip() != "":
        a.DateOfBirth = getdate(d["DOB"])
    if a.DateOfBirth is None:
        a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365)
    a.CreatedDate = a.DateBroughtIn
    a.LastChangedDate = a.DateBroughtIn
    a.ShortCode = d["File"]
    a.ShelterCode = str(a.ID) + " " + d["File"]
    a.BreedID = asm.breed_id_for_name(d["Breed"].replace(" mix", ""))
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    if d["Breed"].find("mix") != -1:
        a.CrossBreed = 1
        a.Breed2ID = 442
        a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
    a.BaseColourID = asm.colour_id_for_name(d["Color"])

    a.Sex = asm.getsex_mf(d["Male Female"])
    a.Weight = asm.cint(d["Weight"].replace("lbs", "").strip())

    if a.Weight > 0:
        l = asm.Log()
        logs.append(l)
        l.LogTypeID = 4  # Weight
        l.LinkID = a.ID
Exemplo n.º 36
0
    a.AnimalTypeID = gettype(row[SPECIES])
    a.generateCode(gettypeletter(a.AnimalTypeID))
    if strip(row, SPECIES) == "Canine":
        a.SpeciesID = 1
    elif strip(row, SPECIES) == "Feline":
        a.SpeciesID = 2
    else:
        a.SpeciesID = asm.species_id_for_name(row[SPECIES])
    ob = strip(row, TYPE)
    if ob.endswith("X"):
        a.Breed2ID = 442
    elif ob.find(" X") != -1:
        obs = ob.split("X")
        if len(obs) == 2:
            a.BreedID = asm.breed_id_for_name(obs[0])
            a.Breed2ID = asm.breed_id_for_name(obs[1])
        else:
            a.BreedID = asm.breed_id_for_name(ob)
    else:
        a.BreedID = asm.breed_id_for_name(ob)
    a.BreedName = asm.breed_name(a.BreedID, a.Breed2ID)
    a.Sex = getsexmf(row[SEX])
    a.BaseColourID = asm.customcolour_id_for_name(strip(row, COLOUR).replace("&", "and"), True)
    a.RabiesTag = row[TAG_NO]
    a.TattooNumber = row[TATOO]
    a.IdentichipNumber = row[CHIP]
    if a.TattooNumber.strip() != "": 
        a.Tattoo = 1
        a.TattooDate = a.DateBroughtIn
    if a.IdentichipNumber.strip() != "": 
Exemplo n.º 37
0
 typecol = ""
 breedcol = ""
 breed2col = ""
 if row.has_key("type"):
     typecol = row["type"]
     breedcol = row["breed"]
     breed2col = row["secondBreed"]
 else:
     # We're going to have to look them up from the speciesID and
     # secondarySpeciesID fields
     typecol = getsbtypenamefromspeciesid(row["speciesID"])
     breedcol = getsbbreednamefromspeciesid(row["speciesID"])
     breed2col = getsbbreednamefromspeciesid(row["secondarySpeciesID"])
 a.AnimalTypeID = asm.type_id_for_name(typecol)
 a.SpeciesID = asm.species_id_for_name(typecol)
 a.BreedID = asm.breed_id_for_name(breedcol)
 a.Breed2ID = asm.breed_id_for_name(breed2col)
 if row["DateIN"].strip() != "": 
     a.DateBroughtIn = getdate(row["DateIN"])
     if a.DateBroughtIn is None:
         a.DateBroughtIn = getdate(row["AddDateTime"])
         if a.DateBroughtIn is None:
             print "BOLLOCKS: " + str(row)
 if row["DateOUT"].strip() != "":
     a.ActiveMovementDate = getdate(row["DateOUT"])
     if a.ActiveMovementDate is not None:
         a.ActiveMovementType = 1
         a.Archived = 1
     elif a.DateBroughtIn.year < 2015:
         a.Archived = 1
 a.Neutered = row["desexdate"].strip() != "" and 1 or 0
Exemplo n.º 38
0
    a.AnimalTypeID = 2 # DOG
    a.SpeciesID = 1    # DOG
    a.AnimalName = row[DOGNAME]
    a.DateOfBirth = getdate_fromage(row[DOGAGE])
    a.EstimatedDOB = 1
    comments += "Age: " + row[DOGAGE] + ", "
    datebroughtin = getdate(row[RECORDDATE])
    if datebroughtin == None:
        datebroughtin = datetime.datetime.today()
    a.DateBroughtIn = datebroughtin
    a.ShelterCode = row[TAG]
    a.IsNotAvailableForAdoption = 1
    a.Sex = getsexmf(row[DOGSEX])
    a.BaseColourID = asm.colour_id_for_name(row[COLOR], True)
    comments += "Original color: " + row[COLOR] + ", "
    a.BreedID = asm.breed_id_for_name(row[DOGBREED])
    a.Breed2ID = asm.breed_id_for_name(row[DOGBREED])
    a.BreedName = asm.breed_name_for_id(a.BreedID)
    a.CrossBreed = 0
    comments += "Original breed: " + row[DOGBREED] + ", "
    a.Neutered = row[ALTERED].find("Y") != -1 and 1 or 0
    a.NeuteredDate = getdate(row[ALTEREDDATE])
    a.Identichipped = row[MICROCHIPNO].strip() != "" and 1 or 0
    a.IdentichipNumber = row[MICROCHIPNO]
    comments += "Vaccination Type: " + row[VACCINATIONTYPE] + ", "
    comments += "Vaccination Date: " + row[VACCINATIONDATE] + ", "
    comments += "Vaccination Man: " + row[VACCINATIONMANUFACTURER] + ", "
    comments += "Vaccination Lot: " + row[VACCINATIONLOT]
    a.AnimalComments = row[NOTES1] + " " + row[COMMENTS]
    a.HiddenAnimalDetails = comments