示例#1
0
 a.ShortCode = d["Animal ID"]
 a.ShelterCode = d["Animal ID"]
 ppa[d["Animal ID"]] = a
 a.AnimalName = d["Name"]
 if "Created Date" in d: a.DateBroughtIn = getdate(d["Created Date"])
 dob = a.DateBroughtIn
 if dob is None: dob = asm.today()
 a.EstimatedDOB = 1
 # Ages are stored as 2Y/ 4M/ 26D
 # If this column isn't present, we've also seen an Age (Months) column in intake.csv
 age = ""
 if "Age (Y/M/D)" in d:
     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)
 color = "Black"
 if "Primary Color" in d: color = d["Primary Color"]
 a.BaseColourID = asm.colour_id_for_name(color)
 if "Current Weight" in d and d["Current Weight"] != "":
     a.Weight = asm.atof(d["Current Weight"])
示例#2
0
文件: ark_dbf.py 项目: magul/asm3
 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:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 365)
     elif d["AGE"].find("M") != -1:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 30)
 a.DateOfBirth = dob
 if d["EUTH_USD"] > 0:
     a.PutToSleep = 1
     a.Archived = 1
     a.DeceasedDate = d["DATE_DISPO"]
 comments = "Original breed: %s\nColor: %s" % (d["BREED"].strip(), d["COLOR"].strip())
 if asm.nulltostr(d["PU_LOC"]).strip() != "":
     comments += "\nPicked up from: %s" % d["PU_LOC"]
 a.HiddenAnimalDetails = comments
 a.AnimalComments = asm.nulltostr(d["ANIMAL_TXT"]).strip()
 a.HealthProblems = d["HEALTH"]
 a.LastChangedDate = a.DateBroughtIn
 if d["ADPT_ID"] != "":
示例#3
0
文件: ark_dbf.py 项目: tgage/asm3
 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:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 365)
     elif d["AGE"].find("M") != -1:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 30)
 a.DateOfBirth = dob
 if d["EUTH_USD"] > 0:
     a.PutToSleep = 1
     a.Archived = 1
     a.DeceasedDate = d["DATE_DISPO"]
 comments = "Original breed: %s\nColor: %s" % (d["BREED"].strip(),
                                               d["COLOR"].strip())
 if asm.nulltostr(d["PU_LOC"]).strip() != "":
     comments += "\nPicked up from: %s" % d["PU_LOC"]
 a.HiddenAnimalDetails = comments
 a.AnimalComments = asm.nulltostr(d["ANIMAL_TXT"]).strip()
 a.HealthProblems = d["HEALTH"]
 a.LastChangedDate = a.DateBroughtIn
示例#4
0
文件: ark_csv.py 项目: magul/asm3
 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.getdate_mmddyy(d["DATE_SURR"])
 if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
 a.NeuteredDate = asm.getdate_mmddyy(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:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 365)
     elif d["AGE"].find("M") != -1:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 30)
 a.DateOfBirth = dob
 if asm.atoi(d["EUTH_USD"]) > 0:
     a.PutToSleep = 1
     a.Archived = 1
     a.DeceasedDate = asm.getdate_mmddyy(d["DATE_DISPO"])
 comments = "Original breed: %s\nColor: %s" % (d["BREED"].strip(), d["COLOR"].strip())
 if asm.nulltostr(d["PU_LOC"]).strip() != "":
     comments += "\nPicked up from: %s" % d["PU_LOC"]
 a.HiddenAnimalDetails = comments
 a.AnimalComments = asm.nulltostr(d["ANIMAL_TXT"]).strip()
 a.HealthProblems = d["HEALTH"]
 a.LastChangedDate = a.DateBroughtIn
 if d["ADPT_ID"] != "":
示例#5
0
 a.LastChangedDate = a.DateBroughtIn
 a.EntryReasonID = 1
 #a.generateCode(gettypeletter(a.AnimalTypeID))
 code = "MO" + asm.padleft(row["tblAnimalsID"], 6)
 a.ShelterCode = code
 a.ShortCode = code
 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))
示例#6
0
 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.getdate_mmddyy(d["DATE_SURR"])
 if a.DateBroughtIn is None: a.DateBroughtIn = asm.now()
 a.NeuteredDate = asm.getdate_mmddyy(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:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 365)
     elif d["AGE"].find("M") != -1:
         dob = asm.subtract_days(dob, asm.atoi(d["AGE"]) * 30)
 a.DateOfBirth = dob
 if asm.atoi(d["EUTH_USD"]) > 0:
     a.PutToSleep = 1
     a.Archived = 1
     a.DeceasedDate = asm.getdate_mmddyy(d["DATE_DISPO"])
 comments = "Original breed: %s\nColor: %s" % (d["BREED"].strip(),
                                               d["COLOR"].strip())
 if asm.nulltostr(d["PU_LOC"]).strip() != "":
     comments += "\nPicked up from: %s" % d["PU_LOC"]
 a.HiddenAnimalDetails = comments
 a.AnimalComments = asm.nulltostr(d["ANIMAL_TXT"]).strip()
 a.HealthProblems = d["HEALTH"]
 a.LastChangedDate = a.DateBroughtIn
示例#7
0
文件: multiops.py 项目: magul/asm3
     a.DateBroughtIn = asm.now()
 a.EntryReasonID = 1
 #a.generateCode(gettypeletter(a.AnimalTypeID))
 code = "MO" + asm.padleft(row["tblAnimalsID"], 6)
 a.ShelterCode = code
 a.ShortCode = code
 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)
示例#8
0
 a.SpeciesID = asm.species_id_for_name(d["Species"])
 a.generateCode()
 a.ShortCode = d["Animal ID"]
 a.ShelterCode = d["Animal ID"]
 ppa[d["Animal ID"]] = a
 a.AnimalName = d["Name"]
 if "Intake Date" in d: a.DateBroughtIn = getdate(d["Intake Date"])
 if a.DateBroughtIn is None and "Created Date" in d:
     a.DateBroughtIn = getdate(d["Created Date"])
 dob = a.DateBroughtIn
 a.EstimatedDOB = 1
 # 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"])