Exemple #1
0
 if row["REGISTRATI"] != "": 
     a.ShelterCode = "%s (%s)" % (row["REGISTRATI"], row["ANIMALKEY"])
     a.ShortCode = row["REGISTRATI"]
 a.SpeciesID = asm.species_id_for_name(row["ANIMLDES"].split(" ")[0])
 a.AnimalName = row["PETNAME"]
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 age = row["AGE"].split(" ")[0]
 a.DateOfBirth = asm.getdate_yyyymmdd(row["DOB"])
 if a.DateOfBirth is None: a.DateOfBirth = asm.now()
 a.EntryReasonID = 4
 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"])
Exemple #2
0
     else:
         a.AnimalTypeID = 2
 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
Exemple #3
0
         a.AnimalTypeID = 11
 elif d["SPECIES"] == "R":
     # Rabbit
     a.SpeciesID = 7
     a.AnimalTypeID = 13
     if d["SURR_CODE"] == "STR":
         a.EntryReasonID = 11
 else:
     # SPECIES == "O" for other, BREED contains species instead
     a.SpeciesID = asm.species_id_for_name(d["BREED"])
     a.AnimalTypeID = 13  # Miscellaneous
     a.EntryReasonID = 11
 if d["SURR_ID"] != "":
     if d["SURR_ID"] in ppo:
         a.OriginalOwnerID = ppo[d["SURR_ID"]].ID
 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 = asm.todatetime(d["DATE_SURR"])
 if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
 a.generateCode()
 a.ShortCode = d["ID_NUM"]
 a.NeuteredDate = d["NEUTER_DAT"]
 if a.NeuteredDate is not None:
Exemple #4
0
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"]
    a.Markings = row["distinctive features"]
    a.DeceasedDate = asm.getdate_iso(row["date of death"])
    a.PTSReason = row["reason of death"]
    a.RabiesTag = row["tag #"]
Exemple #5
0
 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 #"]
 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.HiddenAnimalDetails = a.HiddenAnimalDetails.replace("\\", "/")
Exemple #6
0
        a.AnimalTypeID = 2 # Unwanted Dog
    else:
        a.AnimalTypeID = 40 # Misc
    a.SpeciesID = asm.species_id_for_name(d["Species"])
    a.AnimalName = d["Name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateBroughtIn = getdate(d["Date of Well Check"]) or getdate(d["Adopted Date"]) or getdate(d["Birthday"]) or asm.today()
    a.DateOfBirth = getdate(d["Birthday"]) or a.DateBroughtIn
    a.CreatedDate = a.DateBroughtIn
    a.LastChangedDate = a.DateBroughtIn
    a.ShelterCode = d["ID"][d["ID"].rfind("-")+1:]
    a.ShortCode = a.ShelterCode
    a.BaseColourID = asm.colour_id_for_name(d["Animal Color"])
    a.IsNotAvailableForAdoption = 0
    a.Sex = asm.getsex_mf(d["Sex"])
    a.Size = 2
    a.Neutered = asm.iif(d["Spay / Neuter"] == "Yes", 1, 0)
    a.EntryReasonID = 17 # Surrender
    a.Archived = 0
    a.HiddenAnimalDetails = "Color: %s\nPrevious Name: %s\nBiter: %s\nDiet: %s\n%s" % (d["Animal Color"], d["Previous Name"], d["Biter"], d["Diet"], d["Special Needs"])
    a.SourceAdoptedDate = getdate(d["Adopted Date"])

    if d["Deceased Date"] != "":
        a.PutToSleep = 0
        a.DeceasedDate = getdate(d["Deceased Date"])
        a.Archived = 1
        a.PTSReason = d["Deceased Reason"]

for d in asm.csv_to_list("%s/relinquishment_contacts.csv" % PATH):
    o = asm.Owner()
Exemple #7
0
     a.DateBroughtIn = asm.today()
 a.CreatedDate = asm.getdate_mmddyyyy(d["Added On"])
 a.CreatedBy = "%s/%s" % (d["Added By"], "conversion")
 a.LastChangedDate = asm.getdate_mmddyyyy(d["Updated On"])
 a.LastChangedBy = d["Last Updated By"]
 if d["Intake Type"] == "Shelter Transfer" or d[
         "Intake Type"] == "Rescue Transfer":
     a.IsTransfer = 1
 a.ShelterCode = d["Pet ID"]
 a.ShortCode = d["Pet ID"]
 a.Markings = d["Colors or Markings"]
 a.BaseColourID = asm.colour_id_for_name(d["Colors or Markings"], True)
 a.IsNotAvailableForAdoption = 0
 a.ShelterLocation = 1
 a.ShelterLocationUnit = d["Cage Number"]
 a.Sex = asm.getsex_mf(d["Gender"])
 a.Size = asm.size_from_db(d["Size"])
 a.Weight = asm.cfloat(d["Weight"])
 if d["Is Declawed"] == "Yes":
     a.Declawed = 1
 if d["HIV Positive"] == "Yes":
     a.CombiTested = 1
     a.CombiTestResult = 0
 if d["Has Tattoo"] == "Yes":
     a.Tattoo = 1
 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
Exemple #8
0
 # TODO: DOB is not always present in these things
 a.DateOfBirth = row["DOB"]
 if a.DateOfBirth is None: a.DateOfBirth = getdateage(age, row["ADDEDDATET"])
 a.DateBroughtIn = row["ADDEDDATET"]
 if a.DateBroughtIn is None:
     asm.stderr("Bad datebroughtin: '%s'" % row["ADDEDDATET"])
     a.DateBroughtIn = datetime.datetime.today()    
 a.LastChangedDate = a.DateBroughtIn
 a.CreatedDate = a.DateBroughtIn
 a.EntryReasonID = 4
 a.generateCode(gettypeletter(a.AnimalTypeID))
 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
Exemple #9
0
 added = asm.now()
 if "ADDEDDATET" in row and row["ADDEDDATET"] is not None:
     added = row["ADDEDDATET"]
 if "DOB" in row: a.DateOfBirth = row["DOB"]
 if a.DateOfBirth is None: a.DateOfBirth = getdateage(age, added)
 a.DateBroughtIn = added
 a.LastChangedDate = a.DateBroughtIn
 a.CreatedDate = a.DateBroughtIn
 a.EntryReasonID = 4
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row["ANIMALKEY"]
 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"])
 if a.IdentichipNumber != "": a.Identichipped = 1
 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":
Exemple #10
0
     a.Neutered = 1
 # 1 = neutered, 2 = spayed, 3 = entire, 5 = unknown
 if row["sysAlteredChoicesID"] == "1" or row["sysAlteredChoicesID"] == "2":
     a.Neutered = 1
 a.Markings = row["DistinguishingMarks"]
 a.HealthProblems = row["Condition"]
 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) -
Exemple #11
0
 a.NeuteredDate = asm.getdate_mmddyy(row["SpayNeuterPerformedDate"])
 if a.NeuteredDate is not None:
     a.Neutered = 1
 # 1 = neutered, 2 = spayed, 3 = entire, 5 = unknown
 if row["sysAlteredChoicesID"] == "1" or row["sysAlteredChoicesID"] == "2":
     a.Neutered = 1
 a.Markings = row["DistinguishingMarks"]
 a.HealthProblems = row["Condition"]
 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)
 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
 a.NeuteredDate = (row["ALTEREDATINTAKE"] == "N"
                   and a.Neutered == 1) and a.DateBroughtIn or None
 if ecode is None: ecode = ""
 a.SpeciesID = asm.species_id_for_name(row.Species)
 if a.SpeciesID == 1 and ecode == "STR":
     a.AnimalTypeID = 10
 elif a.SpeciesID == 1:
     a.AnimalTypeID = 2
 elif a.SpeciesID == 2 and ecode == "STR":
     a.AnimalTypeID = 12
 else:
     a.AnimalTypeID = 11
 a.ReasonForEntry = "%s. %s" % (ecode, row.IntakeComments)
 a.EntryReasonID = 7  # Stray
 if ecode.startswith("O"): a.EntryReasonID = 17  # Owner
 asm.breed_ids(a, row.Breed1, row.Breed2)
 a.BaseColourID = asm.colour_id_for_name(row.Color, firstWordOnly=True)
 a.Sex = asm.getsex_mf(row.Sex)
 a.generateCode(gettypeletter(a.AnimalTypeID))
 a.ShortCode = row.AnimalUid
 a.AnimalName = row.Name
 if a.AnimalName.strip() == "":
     a.AnimalName = "(unknown)"
 a.RabiesTag = row.RabiesNum
 a.ShelterLocationUnit = row.CageLocation
 a.Markings = row.Marking
 a.GoodWithCats = ynu(row.GoodWithCats)
 a.GoodWithDogs = ynu(row.GoodWithDogs)
 a.GoodWithChildren = ynu(row.GoodWithChildren)
 a.HouseTrained = ynu(row.HouseBroken)
 a.AnimalComments = row.Comments
 a.HiddenAnimalDetails = "Original breed: %s / %s, color: %s" % (
     row.Breed1, row.Breed2, row.Color)
Exemple #14
0
     # Canine
     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.AnimalName = "(unknown)"
 typecol = row["Type"]
 breedcol = row["Breed"]
 breed2col = row["Secondary Breed"]
 a.AnimalTypeID = asm.type_id_for_name(typecol)
 a.generateCode(asm.type_name_for_id(a.AnimalTypeID))
 a.SpeciesID = asm.species_id_for_name(typecol)
 asm.breed_ids(a, breedcol, breed2col)
 a.DateBroughtIn = getdate(row["Incoming Date"])
 a.DateOfBirth = getdate(row["DOB"])
 if a.DateOfBirth is None: a.DateOfBirth = a.DateBroughtIn
 a.Neutered = row["Spay/Neutered"].strip().lower() == "yes" and 1 or 0
 a.NeuteredDate = getdate(row["Spay/Neutered Date"])
 a.IdentichipNumber = row["Microchip"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Sex = asm.getsex_mf(row["Gender"])
 a.BaseColourID = asm.colour_id_for_names(row["Color"], row["Second Color"])
 a.ReasonForEntry = row["Surrender Reason"]
 a.EntryReasonID = 11
 if row["Source (Current)"] == "Stray":
     a.EntryReasonID = 7
 comments = "Original Type: " + typecol
 comments += "\nOriginal Breed: " + breedcol + "/" + breed2col
 comments += "\nOriginal Colour: " + row["Color"] + "/" + row["Second Color"]
 comments += "\nSource: " + row["Source (Current)"]
 comments += "\nStatus: " + row["Status (Current)"]
 a.HiddenAnimalDetails = comments
 a.Markings = row["Distinguishing Features"]
 a.PTSReason = row["Euthanasia Reason"]
 a.AnimalComments = row["General Notes from animal details screen"]
 a.CreatedDate = a.DateBroughtIn
Exemple #16
0
 # 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"])
 a.AnimalComments = d["Comments"]
 a.IdentichipDate = asm.getdate_mmddyy(d["MicrochipDate"])
 if a.IdentichipDate is not None:
     a.Identichipped = 1
Exemple #17
0
     # Canine
     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()