コード例 #1
0
ファイル: ark_dbf.py プロジェクト: tgage/asm3
        od.DonationTypeID = 4  # Surrender
        if p["PMNT_CODE"] == "ADP":
            od.DonationTypeID = 2

for l in DBF("%s/LICENSE.DBF" % PATH):
    ol = asm.OwnerLicence()
    ownerlicences.append(ol)
    if ppo.has_key(l["OWNER_ID"]):
        o = ppo[l["OWNER_ID"]]
        ol.OwnerID = o.ID
        ol.LicenceTypeID = 1
        ol.LicenceNumber = l["LIC_NUM"]
        ol.LicenceFee = int(l["FEE"] * 100)
        ol.IssueDate = l["LIC_DATE"]
        if ol.IssueDate is None:
            ol.IssueDate = asm.parse_date("2015-01-01", "%Y-%m-%d")
        ol.ExpiryDate = l["LIC_EXDATE"]
        if ol.ExpiryDate is None:
            ol.ExpiryDate = asm.parse_date("2015-01-01", "%Y-%m-%d")

for c in DBF("%s/CMPLAINT.DBF" % PATH, encoding="cp1252"):
    ac = asm.AnimalControl()
    animalcontrol.append(ac)
    if c["FROM_ID"] != "" and ppo.has_key(c["FROM_ID"]):
        ac.CallerID = ppo[c["FROM_ID"]].ID
    if c["ABOUT_ID"] != "" and ppo.has_key(c["ABOUT_ID"]):
        ac.OwnerID = ppo[c["ABOUT_ID"]].ID
    ac.CallDateTime = c["C_DATE"]
    if ac.CallDateTime is None:
        ac.CallDateTime = asm.parse_date("2015-01-01", "%Y-%m-%d")
    ac.IncidentDateTime = ac.CallDateTime
コード例 #2
0
def getdatetime(d, noblanks=False):
    rv = asm.parse_date(d, "%Y/%m/%d %H:%M:%S")
    if noblanks and rv is None: rv = asm.now()
    return rv
コード例 #3
0
ファイル: ark_dbf.py プロジェクト: magul/asm3
        od.Date = p["PMNT_DATE"]
        od.DonationTypeID = 4 # Surrender
        if p["PMNT_CODE"] == "ADP":
            od.DonationTypeID = 2

for l in DBF("%s/LICENSE.DBF" % PATH):
    ol = asm.OwnerLicence()
    ownerlicences.append(ol)
    if ppo.has_key(l["OWNER_ID"]):
        o = ppo[l["OWNER_ID"]]
        ol.OwnerID = o.ID
        ol.LicenceTypeID = 1
        ol.LicenceNumber = l["LIC_NUM"]
        ol.LicenceFee = int(l["FEE"] * 100)
        ol.IssueDate = l["LIC_DATE"]
        if ol.IssueDate is None: ol.IssueDate = asm.parse_date("2015-01-01", "%Y-%m-%d")
        ol.ExpiryDate = l["LIC_EXDATE"]
        if ol.ExpiryDate is None: ol.ExpiryDate = asm.parse_date("2015-01-01", "%Y-%m-%d")

for c in DBF("%s/CMPLAINT.DBF" % PATH, encoding="cp1252"):
    ac = asm.AnimalControl()
    animalcontrol.append(ac)
    if c["FROM_ID"] != "" and ppo.has_key(c["FROM_ID"]):
        ac.CallerID = ppo[c["FROM_ID"]].ID
    if c["ABOUT_ID"] != "" and ppo.has_key(c["ABOUT_ID"]):
        ac.OwnerID = ppo[c["ABOUT_ID"]].ID
    ac.CallDateTime = c["C_DATE"]
    if ac.CallDateTime is None:
        ac.CallDateTime = asm.parse_date("2015-01-01", "%Y-%m-%d")
    ac.IncidentDateTime = ac.CallDateTime
    ac.DispatchDateTime = ac.CallDateTime
コード例 #4
0
ファイル: multiops.py プロジェクト: Reeco2014/asm3
    l = asm.Log()
    logs.append(l)
    l.LogTypeID = 3
    l.LinkID = a.ID
    l.LinkType = 1
    l.Date = asm.now()
    l.Comments = row["Note"]

asm.stderr("Process complaints")
for row in ccomplaints:
    ac = asm.AnimalControl()
    ppac[row["tblComplaintsID"]] = ac
    animalcontrol.append(ac)
    ac.CallDateTime = asm.getdate_mmddyy(row["ReceivedDate"])
    if ac.CallDateTime is None:
        ac.CallDateTime = asm.parse_date("2015-01-01", "%Y-%m-%d")
    ac.IncidentDateTime = ac.CallDateTime
    incidentname = asm.find_value(ccomplainttypes, "sysComplaintTypesID",
                                  row["sysComplaintTypesID"], "ComplaintType")
    ac.IncidentTypeID = asm.incidenttype_from_db(incidentname)
    ac.DispatchDateTime = ac.CallDateTime
    ac.CompletedDate = asm.getdate_mmddyy(row["StatusDate"])
    if ac.CompletedDate is None:
        ac.CompletedDate = ac.CallDateTime
    ac.DispatchAddress = row["StreetNumber"] + " " + row["Street"]
    ac.DispatchTown = row["City"]
    ac.DispatchCounty = row["State"]
    ac.DispatchPostcode = row["ZipCode"]
    comments = ""
    if row["Location"].strip() != "":
        comments += "Location: %s" % row["Location"]
コード例 #5
0
def getdate(d):
    return asm.parse_date(d, "%d.%m.%y")
コード例 #6
0
ファイル: multiops.py プロジェクト: magul/asm3
    a = ppo[row["tblKnownPersonsID"]]
    l = asm.Log()
    logs.append(l)
    l.LogTypeID = 3
    l.LinkID = a.ID
    l.LinkType = 1
    l.Date = asm.now()
    l.Comments = row["Note"]

for row in ccomplaints:
    ac = asm.AnimalControl()
    ppac[row["tblComplaintsID"]] = ac 
    animalcontrol.append(ac)
    ac.CallDateTime = asm.getdate_mmddyy(row["ReceivedDate"])
    if ac.CallDateTime is None:
        ac.CallDateTime = asm.parse_date("2015-01-01", "%Y-%m-%d")
    ac.IncidentDateTime = ac.CallDateTime
    incidentname = asm.find_value(ccomplainttypes, "sysComplaintTypesID", row["sysComplaintTypesID"], "ComplaintType")
    ac.IncidentTypeID = asm.incidenttype_from_db(incidentname)
    ac.DispatchDateTime = ac.CallDateTime
    ac.CompletedDate = asm.getdate_mmddyy(row["StatusDate"])
    if ac.CompletedDate is None:
        ac.CompletedDate = ac.CallDateTime
    ac.DispatchAddress = row["StreetNumber"] + " " + row["Street"]
    ac.DispatchTown = row["City"]
    ac.DispatchCounty = row["State"]
    ac.DispatchPostcode = row["ZipCode"]
    comments = ""
    if row["Location"].strip() != "": comments += "Location: %s" % row["Location"]
    comments += "\nMO ID: %s" % row["tblComplaintsID"]
    ac.CallNotes = comments
コード例 #7
0
#!/usr/bin/python3

import asm

"""
Import script for ARK DBF databases, covers people, animals, payments, events, licences and complaints

21st March, 2015
Last changed: 12th Mar, 2022
"""

PATH = "/home/robin/tmp/asm3_import_data/ark_tp2734"
START_ID = 1000
PICTURE_IMPORT = True

BLANK_DATE = asm.parse_date("2015-01-01", "%Y-%m-%d") # Date used for licenses and incidents when the date was blank in ARK

owners = []
ownerdonations = []
ownerlicences = []
movements = []
logs = []
animals = []
animalcontrol = []
ppa = {}
ppo = {}

arkspecies = {
    "C": 1, # Dog
    "F": 2, # Cat
    "E": 24,# Horse