Beispiel #1
0
 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)
 a.DateOfBirth = d["BIRTHDATE"]
 if a.DateOfBirth is None:
     a.EstimatedDOB = 1
     a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365)
 a.PickupAddress = d["CITY"]
 a.AnimalComments = d["NOTES"]
 a.Markings = d["MARKINGS"]
 comments = "Status: %s" % d["STATUS"]
 comments += "\nOriginal breed: %s / %s" % (d["BREED1"], d["BREED2"])
 comments += "\nColor: %s / %s" % (d["COLOR1"], d["COLOR2"])
 comments += "\nPattern: %s" % d["PATTERN"]
 comments += "\nAge Group: %s" % d["AGEGROUP"]
Beispiel #2
0
         a.Archived = 1
 a.Neutered = row["desexdate"].strip() != "" and 1 or 0
 a.NeuteredDate = getdate(row["desexdate"])
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 a.CrossBreed = row["crossbreed"] == "TRUE" and 1 or 0
 if a.CrossBreed == 1:
     a.Breed2ID = 442
 if row["dob"].strip() != "":
     a.DateOfBirth = getdate(row["dob"])
 if a.DateOfBirth is None:
     a.DateOfBirth = a.DateBroughtIn
 a.IdentichipNumber = row["MicroChip"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Sex = getsex12(row["Sex"])
 a.Weight = asm.cfloat(row["weight"])
 a.BaseColourID = asm.colour_id_for_name(row["Colour"])
 a.ShelterLocation = 1
 a.generateCode(asm.type_name_for_id(a.AnimalTypeID))
 a.ReasonForEntry = row["dep_sReason"]
 if row["sOther"] != "":
     a.ReasonForEntry = row["sOther"]
 a.EntryReasonID = 11
 if row["circumstance"].find("Stray"):
     a.EntryReasonID = 7
 comments = "Original Type: " + typecol
 comments += "\nOriginal Breed: " + breedcol + "/" + breed2col
 comments += "\nOriginal Colour: " + row["Colour"] + "/" + row[
     "SecondaryColour"]
 comments += "\nCircumstance: " + row["circumstance"]
 a.HiddenAnimalDetails = comments
 a.AnimalComments = getsbnotes(row["AnimalID"])
Beispiel #3
0
        o.ExcludeFromBulkEmail = d.contactReceiveNoMail
    o.CreatedDate = d.dateAdded or asm.today()
    o.CreatedBy = d.addedBy or "conversion"
    o.LastChangedBy = d.modifiedBy or "conversion"
    o.LastChangedDate = d.dateModifed or o.CreatedDate

# Now dogs
for d in db.select("Dogs").list() + db.select("Dogs_old").list():
    # Each row contains an animal
    a = asm.Animal()
    animals.append(a)
    ppa[d.dogID] = a
    has_intake = True
    a.SpeciesID = 1
    a.AnimalTypeID = 2
    a.BaseColourID = asm.colour_id_for_name(asm.nulltostr(d.dogColor),
                                            firstWordOnly=True)
    a.BreedID = 101  # Greyhound
    a.Breed2ID = a.BreedID
    a.BreedName = "Greyhound"
    a.AnimalName = note_fix(d.dogCallName)
    if a.AnimalName.strip() == "": a.AnimalName = note_fix(d.dogRegisteredName)
    if a.AnimalName.strip() == "": a.AnimalName = "(unknown)"
    a.DateBroughtIn = d.dogIntakeDate or d.dateAdded
    a.DateOfBirth = d.dogDateBorn or a.DateBroughtIn
    a.CreatedDate = d.dateAdded or a.DateBroughtIn
    a.CreatedBy = d.addedBy or "conversion"
    a.LastChangedBy = d.modifiedBy or "conversion"
    a.LastChangedDate = d.dateModified or a.CreatedDate
    a.generateCode()
    if d.dogSerialNum and asm.nulltostr(d.dogSerialNum) != "":
        a.ShortCode = d.dogSerialNum
Beispiel #4
0
 if a.DateBroughtIn is None:
     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 a.CreatedDate is None: a.CreatedDate = asm.today()
 if a.LastChangedDate is None: a.LastChangedDate = asm.today()
 if d["Intake Type"] == "Shelter Transfer" or d[
         "Intake Type"] == "Rescue Transfer" or d[
             "Intake Type"] == "Pet Pulled":
     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
Beispiel #5
0
 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]
 if row[MICROCHIP].strip() != "":
     a.Identichipped = 1
 a.NeuteredDate = getdate(row[NEUTERSPAY])
 a.HeartwormTestDate = getdate(row[HW_TEST])
 if row[HW_TEST].strip() != "": a.HeartwormTested = 1
 a.HeartwormTestResult = getresult(row[HW_RESULTS])
 if row[FIVL_TEST].strip() != "":
     a.CombiTested = 1
 a.CombiTestDate = getdate(row[FIVL_TEST])
Beispiel #6
0
 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
 a.Sex = getsexmf(row[GUEST_MALE])
 if strip(row, VET_ALTERED) != "":
     a.Neutered = 1
     a.NeuteredDate = getdate(row[VET_ALTERED])
 if row[CAT_FIV] == "TRUE":
     a.CombiTested = 1
     a.CombiTestDate = a.DateBroughtIn
     a.CombiTestResult = row[CAT_FIV_RESULT] == "POSITIVE" and 2 or 1
Beispiel #7
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"])
    a.AnimalComments = d["Comments"]
Beispiel #8
0
# 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"]
    a.Markings = row["distinctive features"]
    a.DeceasedDate = asm.getdate_iso(row["date of death"])
    a.PTSReason = row["reason of death"]
    a.RabiesTag = row["tag #"]
     animals.append(a)
     ppa[str(row.AnimalUid)] = a
 a.SpeciesID = asm.species_id_for_name(row.Species)
 if a.SpeciesID == 1 and row.IntakeReason.startswith("Stray"):
     a.AnimalTypeID = 10
 elif a.SpeciesID == 1:
     a.AnimalTypeID = 2
 elif a.SpeciesID == 2 and row.IntakeReason.startswith("Stray"):
     a.AnimalTypeID = 12
 else:
     a.AnimalTypeID = 11
 a.ReasonForEntry = "%s. %s" % (row.IntakeReason, row.IntakeComments)
 a.EntryReasonID = 7 # Stray
 if row.IntakeReason.startswith("Owner"): a.EntryReasonID = 17 # Owner
 asm.breed_ids(a, row.Breed1, row.Breed2)
 a.BaseColourID = asm.colour_id_for_name(row.ColorName, 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.ColorName)
Beispiel #10
0
     breed1 = bb[0]
     if len(bb) > 1: breed2 = bb[1]
     if len(bb) > 2: mixed = "Yes"
     
 a.BreedID = asm.breed_id_for_name(breed1, DEFAULT_BREED)
 if not mixed == "Yes":
     a.Breed2ID = a.BreedID
     a.BreedName = asm.breed_name_for_id(a.BreedID)
     a.CrossBreed = 0
 else:
     a.Breed2ID = a.BreedID
     if breed2 != "":
         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(d["Color (General)"])
 a.ShelterLocation = 1
 if "Size Potential (General)" in d: a.Size = size_id_for_name(d["Size Potential (General)"])
 if "Declawed" in d: a.Declawed = d["Declawed"] == "Yes" and 1 or 0
 if "Special Needs" in d: a.HasSpecialNeeds = d["Special Needs"] == "Yes" and 1 or 0
 a.EntryReasonID = 1
 if "Altered" in d: a.Neutered = d["Altered"] == "Yes" and 1 or 0
 if "Housetrained" in d and d["Housetrained"] == "Yes": a.IsHouseTrained = 0
 if "OK with Dogs" in d and d["OK with Dogs"] == "Yes": a.IsGoodWithDogs = 0
 if "OK with Kids" in d and d["OK with Kids"] == "Yes": a.IsGoodWithChildren = 0
 if "OK with Cats" in d and d["OK with Cats"] == "Yes": a.IsGoodWithCats = 0
 if "Microchip Number" in d: a.IdentichipNumber = d["Microchip Number"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 if "Description" in d: a.AnimalComments = d["Description"]
 if "Description (no html)" in d: a.AnimalComments = d["Description (no html)"]
 summary = ""
Beispiel #11
0
 a.Neutered = row["desexdate"].strip() != "" and 1 or 0
 a.NeuteredDate = getdate(row["desexdate"])
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 a.CrossBreed = row["crossbreed"] == "TRUE" and 1 or 0
 if a.CrossBreed == 1:
     a.Breed2ID = 442
 if row["dob"].strip() != "":
     a.DateOfBirth = getdate(row["dob"])
 if a.DateOfBirth is None:
     a.DateOfBirth = a.DateBroughtIn
 a.IdentichipNumber = row["MicroChip"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Sex = getsex12(row["Sex"])
 a.Weight = asm.cfloat(row["weight"])
 if "size" in row: a.Size = asm.size_id_for_name(row["size"])
 a.BaseColourID = asm.colour_id_for_name(row["Colour"], firstWordOnly=True)
 a.ShelterLocation = 1
 a.generateCode(asm.type_name_for_id(a.AnimalTypeID))
 if "dep_sReason" in row: a.ReasonForEntry = row["dep_sReason"]
 if row["sOther"] != "":
     a.ReasonForEntry = row["sOther"]
 a.EntryReasonID = 11
 if row["circumstance"].find("Stray"):
     a.EntryReasonID = 7
 comments = "Original Type: " + typecol
 comments += "\nOriginal Breed: " + breedcol + "/" + breed2col
 comments += "\nOriginal Colour: " + row["Colour"] + "/" + row[
     "SecondaryColour"]
 comments += "\nLocation: " + getsblocation(row["refugelocation"])
 comments += "\nCircumstance: " + row["circumstance"]
 a.HiddenAnimalDetails = comments
Beispiel #12
0
 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)
 if a.AnimalName == "":
     a.AnimalName = "(unknown)"
 a.Markings = row[RDESCR]
 #comments = ""
 #if strip(row, GENERAL_CONDITION) != "": comments += "Condition: " + row[GENERAL_CONDITION]
 #if strip(row, VICIOUS) != "": comments += ", Vicious: " + row[VICIOUS]
 #if strip(row, DANGEROUS) != "": comments += ", Dangerous: " + row[DANGEROUS]
 #a.HiddenAnimalDetails = bs(comments)
 a.IsNotAvailableForAdoption = 0
Beispiel #13
0
 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 #"]
 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"])
Beispiel #14
0
     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
 if neutered:
     a.Neutered = 1
 if housetrained: a.IsHouseTrained = 0
 if nodogs: a.IsGoodWithDogs = 1
 if nokids: a.IsGoodWithChildren = 1
 if nocats: a.IsGoodWithCats = 1
 a.AnimalComments = description
 a.HiddenAnimalDetails = "original breed: " + breed1 + " " + breed2 + ", hasshots: " + str(hasshots)
 # Now do the dbfs and media inserts for any photos
Beispiel #15
0
     # 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:
            a.OriginalOwnerID = get_asm_ownerid(d["ID"])
            activeowner = a.OriginalOwnerID
        a.IsNotAvailableForAdoption = 0
        a.Sex = asm.getsex_mf(d["Gender"])
        a.Size = 2
        a.Neutered = asm.iif(d["SpayNeuter"] == "TRUE", 1, 0)
        a.IdentichipNumber = d["MicrochipNumber"]
        if a.IdentichipNumber != "N/A" and a.IdentichipNumber != "":
            a.Identichipped = 1
        asm.breed_ids(a, d["Breed"],
                      default=443)  # 443 = Unknown in their data
        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"], default=60)  # 60 = Unknown in their data
        markings = "Breed: %s" % d["Breed"]
        markings += "\nColor: %s" % d["Color"]
        markings += "\nCoat: %s %s" % (d["CoatLength"], d["CoatTexture"])
        markings += "\nCollar: %s" % d["Collar"]
        markings += "\nTail: %s" % d["Tail"]
        if d["Weight"] != "": markings += "\nWeight: %s" % d["Weight"]
        a.Markings = markings
        a.HiddenAnimalDetails = d["Comments"]
        a.AnimalComments = d["CageCardNotes"]
        a.IsGoodWithCats = 2
        a.IsGoodWithDogs = 2
        a.IsGoodWithChildren = 2
        a.HouseTrained = 0

        if d["ID"] in atoi:
Beispiel #17
0
 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]
 if row[MICROCHIP].strip() != "":
     a.Identichipped = 1
 a.NeuteredDate = getdate(row[NEUTERSPAY])
 a.HeartwormTestDate = getdate(row[HW_TEST])
 if row[HW_TEST].strip() != "": a.HeartwormTested = 1
 a.HeartwormTestResult = getresult(row[HW_RESULTS])
 if row[FIVL_TEST].strip() != "":
     a.CombiTested = 1
 a.CombiTestDate = getdate(row[FIVL_TEST])
Beispiel #18
0
    a = asm.Animal(nextanimalid)
    animals.append(a)
    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]
Beispiel #19
0
 a.ShelterCode = d["id"]
 a.AnimalName = d["name"]
 a.AcceptanceNumber = d["litter_id"]
 a.DateBroughtIn = getdate(d["intake_date"])
 if a.DateBroughtIn is None: a.DateBroughtIn = getdate(d["created_at"])
 a.DateOfBirth = getdate(d["birthday"])
 if a.DateOfBirth is None: a.DateOfBirth = a.DateBroughtIn
 a.Sex = 1
 if d["gender"] == "1":  # They use 1 for female, 0 for male
     a.Sex = 0
 a.Size = asm.cint(d["size_when_grown"])
 primary = d["breed"]
 secondary = d["breed_secondary"]
 asm.breed_ids(a, primary, secondary, DEFAULT_BREED)
 color = d["color_primary"]
 a.BaseColourID = asm.colour_id_for_name(color)
 a.IdentichipNumber = d["tattoo"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Weight = asm.atof(d["weight"])
 a.Neutered = d["altered"] == "true" and 1 or 0
 intaketype = d["intake_reason"]
 if intaketype.find("Transfer In") != -1:
     a.IsTransfer = 1
     a.EntryReasonID = 15
 elif intaketype.find("Stray") != -1:
     a.EntryReasonID = 7
 elif intaketype.find("Surrender") != -1 or intaketype.find("Return") != -1:
     a.EntryReasonID = 17
 else:
     a.EntryReasonID = 15  # Stray
 a.Fee = asm.cint(d["adoption_fees_amount"]) * 100
 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
 a.ShelterLocation = 1
 a.IdentichipNumber = strip(row, IDNUM)
 if a.IdentichipNumber.strip() != "":
Beispiel #21
0
    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
        l.LinkType = 0
        l.Date = a.DateBroughtIn
        l.Comments = d["Weight"]

    a.NeuteredDate = getdate(d["Spay Neuter Date"])
    if a.NeuteredDate is not None: a.Neutered = 1
Beispiel #22
0
 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)
 if a.AnimalName == "":
     a.AnimalName = "(unknown)"
 a.Markings = row[RDESCR]
 #comments = ""
 #if strip(row, GENERAL_CONDITION) != "": comments += "Condition: " + row[GENERAL_CONDITION]
 #if strip(row, VICIOUS) != "": comments += ", Vicious: " + row[VICIOUS]
 #if strip(row, DANGEROUS) != "": comments += ", Dangerous: " + row[DANGEROUS]
 #a.HiddenAnimalDetails = bs(comments)
 a.IsNotAvailableForAdoption = 0
Beispiel #23
0
         a.Archived = 1
 a.Neutered = row["desexdate"].strip() != "" and 1 or 0
 a.NeuteredDate = getdate(row["desexdate"])
 a.BreedName = asm.breed_name_for_id(a.BreedID)
 a.CrossBreed = row["crossbreed"] == "TRUE" and 1 or 0
 if a.CrossBreed == 1:
     a.Breed2ID = 442
 if row["dob"].strip() != "":
     a.DateOfBirth = getdate(row["dob"])
 if a.DateOfBirth is None:
     a.DateOfBirth = a.DateBroughtIn
 a.IdentichipNumber = row["MicroChip"]
 if a.IdentichipNumber != "": a.Identichipped = 1
 a.Sex = getsex12(row["Sex"])
 a.Weight = asm.cfloat(row["weight"])
 a.BaseColourID = asm.colour_id_for_name(row["Colour"])
 a.ShelterLocation = 1
 a.generateCode(asm.type_name_for_id(a.AnimalTypeID))
 a.ReasonForEntry = row["dep_sReason"]
 if row["sOther"] != "":
     a.ReasonForEntry = row["sOther"]
 a.EntryReasonID = 11
 if row["circumstance"].find("Stray"):
     a.EntryReasonID = 7
 comments = "Original Type: " + typecol
 comments += "\nOriginal Breed: " + breedcol + "/" + breed2col
 comments += "\nOriginal Colour: " + row["Colour"] + "/" + row["SecondaryColour"]
 comments += "\nCircumstance: " + row["circumstance"]
 a.HiddenAnimalDetails = comments
 a.AnimalComments = getsbnotes(row["AnimalID"])
 if row["euthanasiaType"] != "0":
Beispiel #24
0
 # Ages are stored as 2Y/ 4M/ 26D
 age = d["Age (Y/M/D)"]
 for b in age.split("/"):
     b = b.strip()
     if b.endswith("Y"): dob = asm.subtract_days(dob, 365 * asm.atoi(b))
     if b.endswith("M"): dob = asm.subtract_days(dob, 30 * asm.atoi(b))
     if b.endswith("D"): dob = asm.subtract_days(dob, asm.atoi(b))
 a.DateOfBirth = dob
 a.Sex = 1
 if d["Sex"].startswith("F"):
     a.Sex = 0
 primary = d["Primary Breed"]
 secondary = ""
 if "Secondary Breed" in d: secondary = d["Secondary Breed"]
 asm.breed_ids(a, primary, secondary, DEFAULT_BREED)
 a.BaseColourID = asm.colour_id_for_name(d["Primary Color"])
 if "Current Weight" in d and d["Current Weight"] != "":
     a.Weight = asm.atof(d["Current Weight"])
 a.HiddenAnimalDetails = "Age: %s, Breed: %s / %s, Color: %s" % (
     age, primary, secondary, d["Primary Color"])
 if "Attributes" in d and d["Attributes"] != "":
     a.HiddenAnimalDetails += "\nAttributes: " + d["Attributes"]
     if d["Attributes"].find("Special Needs") != -1: a.HasSpecialNeeds = 1
     if d["Attributes"].find("Cat Friendly") != -1: a.IsGoodWithCats = 0
     if d["Attributes"].find("No cats") != -1: a.IsGoodWithCats = 1
     if d["Attributes"].find("Dog Social") != -1: a.IsGoodWithDogs = 0
     if d["Attributes"].find("No dogs") != -1 or d["Attributes"].find(
             "no other dogs") != -1:
         a.IsGoodWithDogs = 1
     if d["Attributes"].find("No small children") != -1:
         a.IsGoodWithChildren = 5