Ejemplo n.º 1
0
class TODO_SAMPLE(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    __tablename__ = "PLS CHANGE THIS"
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: DEFINE LIST OF COLUMNS
    long = r.Column(r.Float, nullable=False)  #longitude
    lati = r.Column(r.Float, nullable=False)  #latitude
    time = r.Column(r.DateTime, nullable=False)

    # rlinking - do not have to change the variable name
    route_id = r.Column(r.Integer, nullable=True)

    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Geopoint ID": "id",
        "Longitude": "long",
        "Latitude": "lati",
        "Linked Entity": "__link__/route_id",  # __link__ is a reserved keyword
        "Timestamp": "time"
    }  #header:row data
    # use the __link__/ and __ route_id to 'link' route_id onto something
    # the linkage is defined under the rlink dictionary down there
    # see 'RLINK'

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Geopoints"  #display for r routes

    #RLINK - indicate a link (foreign key reference lookup)
    #rlink - ref tablename, fkey, lookup
    #the key defines how a column is linked, route_id is linked
    #to the table Georoute, looking up for the ID in Georoute and retrieving
    #the name.
    rlink = {"route_id": ("Georoute", "id", "name")}

    # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS
    # the key in the insert_list must be the same as the column var name
    def __init__(self, insert_list):
        self.long = insert_list["long"]
        self.lati = insert_list["lati"]
        self.time = insert_list["time"]

        #FOR nullable=True, use a the checkNull method
        self.route_id = r.checkNull(insert_list, "route_id")
Ejemplo n.º 2
0
class Truck_Driver(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Truck_Driver"
    # TODO: DEFINE LIST OF COLUMNS
    name = r.Column(r.String(r.lim.MAX_USERNAME_SIZE),
                    nullable=False,
                    unique=False)
    contact_no = r.Column(r.String(r.lim.MAX_CONTACT_SIZE),
                          nullable=False,
                          unique=True)  #longitude
    password = r.Column(r.String(r.lim.MAX_PASSWORD_SIZE),
                        unique=False,
                        nullable=False)
    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Driver ID": "id",
        "Driver Name": "name",
        "Contact Number": "contact_no"
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Truck_Driver"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS
    # the key in the insert_list must be the same as the column var name
    def __init__(self, insert_list):
        self.name = insert_list["name"]
        self.contact_no = insert_list["contact_no"]
        self.password = insert_list["password"]
Ejemplo n.º 3
0
class Truck_Loc_Log(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Truck_Loc_Log"
    # TODO: DEFINE LIST OF COLUMNS
    loc = r.Column(r.String(r.lim.MAX_LOCATION_SIZE),
                   nullable=False,
                   unique=False)
    time_stamp = r.Column(r.DateTime, nullable=False)
    tracking_num = r.Column(r.String(r.lim.MAX_LOCATION_SIZE),
                            nullable=False,
                            unique=False)

    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Log Number": "id",
        "Location": "loc",
        "Time stamp": "time_stamp",
        "Tracking Number": "tracking_num",
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Truck_Loc_Log"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    def __init__(self, insert_list):
        self.id = insert_list["id"]
        self.loc = insert_list["loc"]
        self.time_stamp = insert_list["time_stamp"]
        self.tracking_num = insert_list["tracking_num"]
Ejemplo n.º 4
0
class Bus_Loc_Log(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Bus_Loc_Log"
    # TODO: DEFINE LIST OF COLUMNS
    activebus_id = r.Column(r.Integer, nullable=False)
    long = r.Column(r.Float, nullable=False)
    lati = r.Column(r.Float, nullable=False)  #latitude
    time_stamp = r.Column(r.DateTime, nullable=False)

    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Log Number": "id",
        "Active Bus id": "activebus_id",
        "Longitude": "long",
        "Latitude": "lati",
        "Time stamp": "time_stamp"
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Bus_Loc_Log"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    def __init__(self, insert_list):
        self.activebus_id = insert_list["activebus_id"]
        self.time_stamp = insert_list["time_stamp"]
        self.long = insert_list["long"]
        self.lati = insert_list["lati"]
Ejemplo n.º 5
0
class Truck(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Truck"
    # TODO: DEFINE LIST OF COLUMNS
    long = r.Column(r.Float, nullable=False)
    lati = r.Column(r.Float, nullable=False)  #latitude
    reg_no = r.Column(r.String(r.lim.MAX_PASSWORD_SIZE),
                      nullable=False,
                      unique=True)
    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Truck ID": "id",
        "Longitude": "long",
        "Latitude": "lati",
        "Registered Number": "reg_no"
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Truck"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS
    # the key in the insert_list must be the same as the column var name
    def __init__(self, insert_list):
        self.long = insert_list["long"]
        self.lati = insert_list["lati"]
        self.reg_no = insert_list["reg_no"]
Ejemplo n.º 6
0
class Param3(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Param3"
    # TODO: DEFINE LIST OF COLUMNS
    param0 = r.Column(r.String, nullable=False)
    param1 = r.Column(r.String, nullable=False)
    param2 = r.Column(r.String, nullable=False)

    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Entity ID": "id",
        "Param0": "param0",
        "Param1": "param1",
        "Param2": "param2"
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Param 3 Model"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS
    # the key in the insert_list must be the same as the column var name
    def __init__(self, insert_list):
        self.param0 = insert_list["param0"]
        self.param1 = insert_list["param1"]
        self.param2 = insert_list["param2"]
Ejemplo n.º 7
0
class Active_Bus(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    __tablename__ = "Active_Bus"
    # TODO: DEFINE LIST OF COLUMNS
    bus_id = r.Column(r.String(r.lim.MAX_USERNAME_SIZE),
                      nullable=False,
                      unique=False)
    #bus_id = r.Column(r.Integer,nullable=False)
    driver_id = r.Column(r.Integer, nullable=False)
    route_num = r.Column(r.Integer, nullable=False)
    time_stamp = r.Column(r.DateTime, nullable=False)
    long = r.Column(r.Float, nullable=False)
    lati = r.Column(r.Float, nullable=False)  #latitude
    current_seqno = r.Column(r.Integer, nullable=False)
    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Log": "id",
        "Bus plate": "bus_id",
        "Driver ID": "driver_id",
        "Route": "route_num",
        "Time Stamp": "time_stamp",
        "Longitude": "long",
        "Latitude": "lati",
        "Current Seq Number": "current_seqno"
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Active_Bus"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS
    # the key in the insert_list must be the same as the column var name
    def __init__(self, insert_list):
        #self.bus_plate = insert_list["bus_plate"]
        self.bus_id = insert_list["bus_id"]
        self.driver_id = insert_list["driver_id"]
        self.route_num = insert_list["route_num"]
        self.time_stamp = insert_list["time_stamp"]
        self.long = insert_list["long"]
        self.lati = insert_list["lati"]
        self.current_seqno = insert_list["current_seqno"]
Ejemplo n.º 8
0
class Georoute(r.Base):
    __tablename__ = "Georoute"
    id = r.Column(r.Integer, primary_key=True)
    name = r.Column(r.String(r.lim.MAX_USERNAME_SIZE),
                    nullable=False,
                    unique=True)

    #The following is for r-listing (resource listing)
    rlist = {"Georoute ID": "id", "Georoute Name": "name"}  #header:row data

    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Georoutes"  #display for r routes

    def __init__(self, insert_list):
        self.name = insert_list["name"]

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    def getselfname(self):
        return self.__class__.__name__
Ejemplo n.º 9
0
class Truck_Log(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Truck_Log"
    # TODO: DEFINE LIST OF COLUMNS
    tracking_number = r.Column(r.String(r.lim.MAX_LOCATION_SIZE),
                               nullable=False,
                               unique=True)
    start_ts = r.Column(r.DateTime, nullable=False)
    end_ts = r.Column(r.DateTime, nullable=False)  #latitude
    truck_id = r.Column(r.Integer, nullable=False)
    driver_id = r.Column(r.Integer, nullable=False)
    route_num = r.Column(r.Integer, nullable=False)

    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Tracking number": "tracking_number",
        "Start Timestamp": "start_ts",
        "End Timestamp": "end_ts",
        "Truck ID": "truck_id",
        "Driver ID": "driver_id",
        "Route Number": "route_num"
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Truck_Log"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    def __init__(self, insert_list):
        self.tracking_number = insert_list["tracking_number"]
        self.truck_id = insert_list["truck_id"]
        self.driver_id = insert_list["driver_id"]
        self.route_num = insert_list["route_num"]
        self.start_ts = insert_list["start_ts"]
        self.end_ts = insert_list["end_ts"]
Ejemplo n.º 10
0
class Geopoint(r.Base):
    __tablename__ = "Geopoint"
    id = r.Column(r.Integer, primary_key=True)
    long = r.Column(r.Float, nullable=False)  #longitude
    lati = r.Column(r.Float, nullable=False)  #latitude
    time = r.Column(r.DateTime, nullable=False)

    # rlinking - do not have to change the variable name
    route_id = r.Column(r.Integer, nullable=True)

    #The following is for r-listing (resource listing)
    rlist = {
        "Geopoint ID": "id",
        "Longitude": "long",
        "Latitude": "lati",
        "Linked Route": "__link__/route_id",  # __link__/ is a reserved keyword
        "Timestamp": "time"
    }  #header:row data
    #
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Geopoints"  #display for r routes

    #rlink - ref tablename, fkey, lookup
    rlink = {"route_id": ("Georoute", "id", "name")}

    def __init__(self, insert_list):
        self.long = insert_list["long"]
        self.lati = insert_list["lati"]
        self.time = insert_list["time"]

        #FOR nullable=True, use a the checkNull method
        self.route_id = r.checkNull(insert_list, "route_id")

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)
Ejemplo n.º 11
0
class Active_Truck(r.Base):
    # PERMA : DO NOT CHANGE ANYTHING HERE UNLESS NECESSARY
    id = r.Column(r.Integer, primary_key=True)

    def __repr__(self):
        return '<%r %r>' % (self.__tablename__, self.id)

    #---------------------------------------------------------

    ######################################################################################################
    # EDITABLE ZONE
    ######################################################################################################
    # TODO: CHANGE TABLENAME
    __tablename__ = "Active_Truck"
    # TODO: DEFINE LIST OF COLUMNS
    tracking_number = r.Column(r.String(r.lim.MAX_LOCATION_SIZE),
                               nullable=False,
                               unique=True)
    location1 = r.Column(r.Boolean(), unique=False, nullable=False)
    location2 = r.Column(r.Boolean(), unique=False, nullable=False)
    location3 = r.Column(r.Boolean(), unique=False, nullable=False)
    location4 = r.Column(r.Boolean(), unique=False, nullable=False)
    # TODO: DEFINE THE RLIST
    #The following is for r-listing (resource listing)
    # the values in the rlist must be the same as the column var name
    rlist = {
        "Tracking number": "tracking_number",
        "Location 1": "location1",
        "Location 2": "location2",
        "Location 3": "location3",
        "Location 4": "location4",
    }  #header:row data

    # TODO: DEFINE THE priKey and display text
    #this primary key is used for rlisting/adding and mod.
    rlist_priKey = "id"
    rlist_dis = "Active_Truck"  #display for r routes

    # TODO: NOT IMPLEMENT YET, PLEASE IGNORE
    #The following is for r-listing on foreign tables
    rlist_flist = {}

    # TODO: CONSTRUCTOR DEFINES, PLEASE ADD IN ACCORDING TO COLUMNS
    # the key in the insert_list must be the same as the column var name
    def __init__(self, insert_list):
        self.tracking_number = insert_list["tracking_number"]
        self.location1 = insert_list["location1"]
        self.location2 = insert_list["location2"]
        self.location3 = insert_list["location3"]
        self.location4 = insert_list["location4"]