Beispiel #1
0
 a.generateCode()
 a.ShortCode = d["id"]
 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:
Beispiel #2
0
        a.CreatedDate = a.DateBroughtIn
        a.LastChangedDate = a.DateBroughtIn
        if d["Type of Intake"] == "Transferred In":
            a.IsTransfer = 1
        a.generateCode()
        a.ShortCode = d["Petstablished ID"]

        a.IsNotAvailableForAdoption = 0
        a.Sex = asm.getsex_mf(d["Gender"])
        a.Size = asm.size_from_db(d["Size"])
        a.Weight = asm.atof(d["Weight"])
        breeds = d["Pet Breed"].split(",")
        breed1 = breeds[0]
        breed2 = ""
        if len(breeds) > 1: breed2 = breeds[1]
        asm.breed_ids(a, breed1, breed2)
        colors = d["Color"].split(",")
        color1 = colors[0]
        color2 = ""
        if len(colors) > 1: color2 = colors[1]
        a.BaseColourID = asm.colour_id_for_names(color1, color2)

        a.Neutered = d["Spayed/Neutered?"].lower() == "yes" and 1 or 0
        a.HasSpecialNeeds = d["Special Need?"].lower() == "yes" and 1 or 0
        a.IsGoodWithDogs = psYesNoUnknown(d["Gets along with Dogs?"])
        a.IsGoodWithCats = psYesNoUnknown(d["Gets along with Cats?"])
        a.IsGoodWithChildren = psYesNoUnknown(d["Gets along with Kids?"])
        a.HouseTrained = 0

        a.EntryReasonID = 17 # Surrender
        if d["Type of Intake"] == "Stray At Large": a.EntryReasonID = 7 # Stray
Beispiel #3
0
        a.IsGoodWithChildren = 2
        if "Intake Condition" in d:
            a.AsilomarIntakeCategory = d[
                "Intake Condition"] == "Healthy" and 0 or 1
        a.HouseTrained = 0
        if a.IdentichipNumber != "":
            a.Identichipped = 1
        a.Archived = 0
        comments = "Intake type: " + d["Intake Type"] + " " + d[
            "Intake Subtype"] + ", breed: " + d["Primary Breed"] + "/"
        if "Secondary Breed" in d: comments += d["Secondary Breed"]
        comments += ", age: " + d["Age Group"]
        if "Intake Condition" in d:
            comments += ", intake condition: " + d["Intake Condition"]
        comments += ", ID: " + d["Animal #"] + ", ARN: " + d["ARN"]
        asm.breed_ids(a, d["Primary Breed"], d["Secondary Breed"])
        a.HiddenAnimalDetails = comments

        if d["Admitter"] != "" and d["Intake Type"] in (
                "Owner/Guardian Surrender", "Transfer In"):
            o = findowner(d["Admitter"])
            if o == None:
                o = asm.Owner()
                owners.append(o)
                o.OwnerName = d["Admitter"]
                bits = o.OwnerName.split(" ")
                if len(bits) > 1:
                    o.OwnerForeNames = bits[0]
                    o.OwnerSurname = bits[len(bits) - 1]
                else:
                    o.OwnerSurname = o.OwnerName
Beispiel #4
0
    elif d["Species"] == "Dog":
        a.AnimalTypeID = 2  # Unwanted Dog
        if d["Entry Category"] == "Stray":
            a.AnimalTypeID = 10  # Stray Dog
    else:
        a.AnimalTypeID = 40  # Misc
    a.SpeciesID = asm.species_id_for_name(d["Species"])
    a.AnimalName = d["Animal name"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.ShelterCode = d["ID number"].strip()
    a.ShortCode = a.ShelterCode
    a.IdentichipNumber = d["Microchip"].strip()
    if a.IdentichipNumber != "": a.Identichipped = 1
    a.Sex = asm.getsex_mf(d["Gender"])
    asm.breed_ids(a, d["Breeds"], d["CrossBreed"])
    a.Neutered = d["Altered"] == "Yes" and 1 or 0
    a.BaseColourID = asm.colour_id_for_name(d["Color"])
    a.Size = 2
    if d["Size"] == "L": a.Size = 1
    if d["Size"] == "XL": a.Size = 0
    if d["Size"] == "S": a.Size = 3
    a.Weight = asm.cfloat(d["Weight"])
    a.Declawed = d["Declawed"] == "Yes" and 1 or 0
    a.HouseTrained = d["Housetrained"] == "Yes" and 2 or 1
    a.HasSpecialNeeds = d["Special needs"] == "Yes" and 1 or 0
    a.GoodWithChildren = d[
        "Needs home without small children"] == "Yes" and 1 or 0
    a.GoodWithCats = d["Needs home without cats"] == "Yes" and 1 or 0
    a.GoodWithDogs = d["Needs home without dogs"] == "Yes" and 1 or 0
Beispiel #5
0
        a.AnimalTypeID = 2  # Unwanted Dog
        a.SpeciesID = 1
    a.AnimalName = d["PET NAME"]
    if a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    a.DateBroughtIn = getdate(d["INTAKE"]) or asm.today().replace(
        year=2017, month=1, day=1)
    a.DateOfBirth = getdate(d["DOB"]) or a.DateBroughtIn
    a.CreatedDate = a.DateBroughtIn
    a.LastChangedDate = a.DateBroughtIn
    a.generateCode()
    a.Sex = asm.getsex_mf(gender)
    breed, color = get_bc(d["BREED/COLOR"])
    breed = breed.strip()
    color = color.strip()
    asm.breed_ids(a, breed)
    a.BaseColourID = asm.colour_id_for_name(color)
    a.Size = 2
    a.Neutered = neutered in ("N", "S") and 1 or 0
    a.EntryReasonID = 17  # Surrender
    a.IdentichipNumber = d["AVID #"]
    if a.IdentichipNumber != "":
        a.Identichipped = 1
    a.IsGoodWithCats = 2
    a.IsGoodWithDogs = 2
    a.IsGoodWithChildren = 2
    a.HouseTrained = 0
    a.AnimalComments = d["NOTES"]
    a.HiddenAnimalDetails = "Foster: " + d["FOSTER"] + ", Breed/Color: " + d[
        "BREED/COLOR"] + ", Species/Gender: " + d["SPECIES / GENDER"]
 if asm.cint(d["AnimalNumber"]) > 0:
     a.ShortCode = d["AnimalNumber"]
 else:
     # Animals with a 0 or non-integer number are non-shelter
     a.NonShelterAnimal = 1
     a.Archived = 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 = asm.Animal()
     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
Beispiel #8
0
def process_impound(d, dt):
    a = asm.Animal()
    animals.append(a)
    a.EntryReasonID = 7  # Stray
    if d["Species"].lower() == "cat":
        a.AnimalTypeID = 12  # Stray Cat
    elif d["Species"].lower() == "dog":
        a.AnimalTypeID = 10  # Stray Dog
    else:
        a.AnimalTypeID = 40  # Misc
    a.SpeciesID = asm.species_id_for_name(d["Species"])
    a.AnimalName = d["Animal's Name"].replace("\n", " ")
    if a.AnimalName == "?" or a.AnimalName.strip() == "":
        a.AnimalName = "(unknown)"
    releasedate = getdate(d["Date of Release"])
    intakedate = getdate(d["Date of P/U"])
    if intakedate is None and releasedate is not None: intakedate = releasedate
    if intakedate is None: intakedate = dt
    a.DateBroughtIn = intakedate
    a.DateOfBirth = asm.subtract_days(a.DateBroughtIn, 365)
    a.CreatedDate = a.DateBroughtIn
    a.LastChangedDate = a.DateBroughtIn
    a.generateCode()
    a.Sex = asm.getsex_mf(d["Sex-Altered?"])
    a.Size = 2
    a.Neutered = asm.iif(
        d["Sex-Altered?"].lower() == "mn" or d["Sex-Altered?"].lower() == "fs",
        1, 0)
    a.IdentichipNumber = d["Microchip"]
    if a.IdentichipNumber != "no chip found" and a.IdentichipNumber != "Unable to scan" and a.IdentichipNumber != "no" and a.IdentichipNumber != "":
        a.Identichipped = 1
    asm.breed_ids(a, d["Breed"], default=442)
    if d["Breed"].lower().find("mix") != -1 or d["Breed"].find("X") != -1:
        a.CrossBreed = 1
        a.Breed2ID = 442
    a.HiddenDetails = "Breed: %s\nColor: %s\nCollar: %s\nTags: %s\nMicrochip: %s\n" % (
        d["Breed"], d["Color"], d["Collar"], d["Tags"], d["Microchip"])
    a.Comments = d["Comments"]
    # Now create the owner
    if d["Owner's Name"] != "n/a" and d["Owner's Name"] != "" and d[
            "Owner's Name"] != "?" and d[
                "Owner's Name"] != "Went to Rescue" and d[
                    "Owner's Name"] != "unknown" and d["Address"] != "" and d[
                        "Address"] != "n/a":
        o = asm.Owner()
        owners.append(o)
        name = d["Owner's Name"]
        lastname = name
        firstname = ""
        if name.find(" ") != -1:
            firstname, lastname = name.split(" ", 1)
        ppo[name] = o
        o.OwnerForeNames = firstname
        o.OwnerSurname = lastname
        o.OwnerName = "%s, %s" % (lastname, firstname)
        o.OwnerAddress = d["Address"]
        o.OwnerTown = "Burnsville"
        o.OwnerCounty = "MN"
        o.HomeTelephone = d["Phone #"]
        # Reclaim if there's a date
        if releasedate is not None:
            m = asm.Movement()
            m.AnimalID = a.ID
            m.OwnerID = o.ID
            m.MovementType = 5
            m.MovementDate = releasedate
            a.Archived = 1
            a.ActiveMovementID = m.ID
            a.ActiveMovementType = 5
            a.LastChangedDate = m.MovementDate
            movements.append(m)
    # Was the animal euthanised?
    if "Euthanized" in d and d["Euthanized"] == "1":
        a.DeceasedDate = releasedate or intakedate
        a.PutToSleep = 1
        a.PTSReasonID = 4
        a.PTSReason = d["If Euthanized, Why?"]
        a.Archived = 1
    # Is this animal still on shelter? If so, we need to get it off with a fake reclaim
    if a.Archived == 0:
        m = asm.Movement()
        m.AnimalID = a.ID
        m.OwnerID = uo.ID
        m.MovementType = 5
        m.MovementDate = releasedate or intakedate
        a.Archived = 1
        a.ActiveMovementID = m.ID
        a.ActiveMovementType = 5
        a.LastChangedDate = m.MovementDate
        movements.append(m)
Beispiel #9
0
    #if d["Intake Type"] == "Transfer In":
    #    a.IsTransfer = 1
    a.generateCode()
    a.IsNotAvailableForAdoption = 0
    a.Sex = asm.getsex_mf(d["Sex"])
    a.Size = 2
    a.Neutered = d["Altered"] == "TRUE" and 1 or 0
    a.EntryReasonID = 17  # Surrender
    a.IsGoodWithCats = 2
    a.IsGoodWithDogs = 2
    a.IsGoodWithChildren = 2
    a.HouseTrained = 0
    a.Archived = 0
    hcomments = "Species: " + d["Species"] + ", Breed: " + d[
        "Breed"] + ", Color: " + d["Color"]
    asm.breed_ids(a, d["Breed"])
    a.BaseColourID = asm.colour_id_for_name(d["Color"])
    a.HiddenAnimalDetails = hcomments
    a.AnimalComments = d["Comments"]

# Then milestones (intakes and movements)
MILESTONE_COLS = [
    "ID", "OrgID", "OrgName", "AddedDate", "AddedBy", "Date", "Type",
    "PersonID", "AnimalID", "Species", "Name", "EntryType", "Ustr1", "Ustr2",
    "Uint1", "Uint2", "Comments"
]
for d in asm.csv_to_list_cols(MILESTONE_FILENAME, MILESTONE_COLS):
    a = None
    o = None
    if d["AnimalID"] in ppa: a = ppa[d["AnimalID"]]
    if d["PersonID"] in ppo: o = ppo[d["PersonID"]]
cvacc = asm.csv_to_list(PATH + "vacc.csv")

for row in canimals:
    a = asm.Animal()
    animals.append(a)
    ppa[row["Animal ID"]] = a
    a.AnimalName = row["Name"]
    if a.AnimalName.strip() == "":
        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