Exemple #1
0
def process_vacc(animalno, vaccdate=None, vaccexpires=None, vaccname=""):
    """ Processes a vaccination record. PP have multiple formats of this data file """
    if ppa.has_key(animalno):
        a = ppa[animalno]
    else:
        asm.stderr("cannot process vacc %s, %s, %s, - no matching animal" %
                   (animalno, vaccdate, vaccname))
        return
    av = asm.AnimalVaccination()
    animalvaccinations.append(av)
    if vaccdate is None:
        vaccdate = a.DateBroughtIn
    av.AnimalID = a.ID
    av.VaccinationID = 8
    vaccmap = {
        "Bordatella": 6,
        "Bordetella": 6,
        "6-in-1 Canine": 8,
        "5-in-1 Canine": 8,
        "4-in-1 Canine": 8,
        "D-A2-P": 8,
        "Rabies": 4,
        "FeLV": 12,
        "FVRCP": 14,
        "Distemper": 1
    }
    for k, i in vaccmap.iteritems():
        if vaccname.find(k) != -1: av.VaccinationID = i
    av.DateRequired = vaccdate
    av.DateOfVaccination = vaccdate
    av.DateExpires = vaccexpires
    av.Comments = "Type: %s" % vaccname
Exemple #2
0
def process_vacc(animalid,
                 vaccdate=None,
                 vaccexpires=None,
                 vaccname="",
                 batchnumber="",
                 manufacturer="",
                 comments=""):
    """ Processes a vaccination record. PP have multiple formats of this data file """
    av = asm.AnimalVaccination()
    animalvaccinations.append(av)
    if vaccdate is None:
        vaccdate = a.DateBroughtIn
    av.AnimalID = animalid
    av.VaccinationID = 8
    vaccmap = {
        "Bordatella": 6,
        "Bordetella": 6,
        "6-in-1 Canine": 8,
        "5-in-1 Canine": 8,
        "4-in-1 Canine": 8,
        "D-A2-P": 8,
        "Rabies": 4,
        "FeLV": 12,
        "FVRCP": 14,
        "Distemper": 1
    }
    for k, i in vaccmap.iteritems():
        if vaccname.find(k) != -1: av.VaccinationID = i
    av.DateRequired = vaccdate
    av.DateOfVaccination = vaccdate
    av.DateExpires = vaccexpires
    av.Manufacturer = manufacturer
    av.BatchNumber = batchnumber
    av.Comments = "Type: %s, %s" % (vaccname, comments)
Exemple #3
0
def create_vacc(vaccname, vaccdate, vaccrenew):
    vacctypes = {
        "Rabies": 4,
        "Distemper": 1,
        "Lepto": 3,
        "Bordetella": 6,
        "Influenza": 10
    }
    given = getdate(vaccdate)
    if given is not None:
        av = asm.AnimalVaccination()
        animalvaccinations.append(av)
        av.AnimalID = a.ID
        av.VaccinationID = vacctypes[vaccname]
        av.DateRequired = given
        av.DateOfVaccination = given
    nx = getdate(vaccrenew)
    if nx is not None and nx > asm.now():
        av = asm.AnimalVaccination()
        animalvaccinations.append(av)
        av.AnimalID = a.ID
        av.VaccinationID = vacctypes[vaccname]
        av.DateRequired = nx
        av.DateOfVaccination = None
    auid = row["ANIMAL NUMBER"]
    if auid.find("&") != -1: auid = auid[0:auid.find("&")]
    if not auid in ppa: continue
    a = ppa[auid]
    date = asm.getdate_mmddyy(row["DATE USED"])
    # Each row contains a vaccination or test
    if row["MED"].startswith("HW Test"):
        a.HeartwormTested = 1
        a.HeartwormTestDate = date
        a.HeartwormTestResult = row["NOTES"].find("gative") != -1 and 1 or 2
    elif row["MED"].startswith("Combo"):
        a.CombiTested = 1
        a.CombiTestDate = date
        a.CombiTestResult = row["NOTES"].find("gative") != -1 and 1 or 2
    else:
        av = asm.AnimalVaccination()
        animalvaccinations.append(av)
        av.DateRequired = date
        av.DateOfVaccination = date
        av.VaccinationID = 6
        if row["MED"].startswith("FelV"): av.VaccinationID = 12
        if row["MED"].startswith("FVRCP"): av.VaccinationID = 9
        if row["MED"].startswith("DA2PP"): av.VaccinationID = 8
        if row["MED"].startswith("Bord"): av.VaccinationID = 6
        if row["MED"].startswith("Rabies"): av.VaccinationID = 4
        if row["MED"].startswith("Lepto"): av.VaccinationID = 3
        av.Comments = "%s %s" % (row["MED"], row["NOTES"])

# Run back through the animals, if we have any that are still
# on shelter after 1 year, add an adoption to an unknown owner
for a in animals:
def animalflags(a, neutered, specialneeds, tested, shots, defyear="03"):
    """ Bits related to special animal flags """
    # neutered
    if neutered.startswith("Y"):
        a.Neutered = 1
    else:
        a.Neutered = 0
    # see if we can parse a neutered date
    neutered = neutered.replace("Y/", "")
    if neutered.find("/") != -1:
        a.NeuteredDate = getmydate(neutered, False, defyear)
# special needs
    if specialneeds.strip() != "":
        a.HasSpecialNeeds = 1
        a.HealthProblems = row[SPECIALNEEDS]
# fivl/fevl tested
    if tested.find("Y") != "":
        a.CombiTested = 1
        tested = tested.lower()
        # Can we get a date in there?
        dbit = tested.split(" ")
        dd = None
        for b in dbit:
            if b.find("/") != -1:
                dd = getmydate(b, True, defyear)
        a.CombiTestDate = dd
        # Default to unknown
        a.CombiTestResult = 0
        a.FLVResult = 0
        # Lets look for a negative first
        if row[TESTED].find("Neg") != -1:
            a.CombiTestResult = 1
            a.FLVResult = 1
    # Individual positives
        if tested.find("fiv+") != -1 or tested.find("fiv +") != -1:
            a.CombiTestResult = 2
        if tested.find("felv+") != -1 or tested.find("felv +") != -1:
            a.FLVResult = 2
        if tested.find("fiv-") != -1 or tested.find("fiv -") != -1:
            a.CombiTestResult = 1
        if tested.find("felv-") != -1 or tested.find("felv -") != -1:
            a.FLVResult = 1

# shots
    shots = shots.replace("\n", " ")
    sb = shots.split(" ")
    firstvacc = False
    secondvacc = False
    thirdvacc = False
    rabiesvacc = False
    boostervacc = False
    for b in sb:
        if b.startswith("1-"):
            dd = getmydate(b.replace("1-", ""), False, defyear)
            if dd != None and not firstvacc:
                firstvacc = True
                av = asm.AnimalVaccination()
                av.DateRequired = dd
                av.DateOfVaccination = dd
                av.AnimalID = a.ID
                av.VaccinationID = 1
                print av
        elif b.startswith("2-"):
            dd = getmydate(b.replace("2-", ""), False, defyear)
            if dd != None and not secondvacc:
                secondvacc = True
                av = asm.AnimalVaccination()
                av.DateRequired = dd
                av.DateOfVaccination = dd
                av.AnimalID = a.ID
                av.VaccinationID = 2
                print av
        elif b.startswith("3-"):
            dd = getmydate(b.replace("3-", ""), False, defyear)
            if dd != None and not thirdvacc:
                thirdvacc = True
                av = asm.AnimalVaccination()
                av.DateRequired = dd
                av.DateOfVaccination = dd
                av.AnimalID = a.ID
                av.VaccinationID = 3
                print av
        elif b.find("/") != -1 and b != 'w/R':
            dd = getmydate(b, False, defyear)
            if dd != None:
                av = asm.AnimalVaccination()
                av.DateRequired = dd
                av.DateOfVaccination = dd
                av.AnimalID = a.ID
                if shots.find("w/R") != -1 and not rabiesvacc:
                    av.VaccinationID = 4
                    rabiesvacc = True
                    print av
                elif not boostervacc:
                    av.VaccinationID = 5
                    boostervacc = True
                    print av

    # good with flags
    a.IsGoodWithCats = 2
    a.IsGoodWithDogs = 2
    a.IsGoodWithChildren = 2
    a.IsHouseTrained = 2