Example #1
0
    def runOnce(self):
        db = DB()
        # Setting the start time boundary of request that we want
        startTime = datetime.datetime.combine(Fitness.yesterday, datetime.datetime.strptime(Fitness.firstMinute, Fitness.formatTime).time())
        # Setting the end time boundary of request that we want
        endTime = datetime.datetime.combine(Fitness.yesterday, datetime.datetime.strptime(Fitness.lastMinute, Fitness.formatTime).time())
        # Create index for the people going on the bus
        Fitness.request = db.grpReqByBusstopAndTime(startTime, endTime)
        self.createRequestIndex(Fitness.request)
        # Create index for the people going down the bus
        Fitness.requestOut = db.getReqCountByEndBusStop(startTime, endTime)
        self.createRequestIndexOut(Fitness.requestOut)

 #<--------------------------------Functions for new encoding including multiple line---------------------------------->

        busLines = set(db.busLine)
        for line in busLines:
            for x in db.timeSliceArray:
                start = datetime.datetime.combine(Fitness.yesterday,datetime.time(x[0], 0, 0))
                end = datetime.datetime.combine(Fitness.yesterday, datetime.time(x[1], 59, 59))
                requestBetweenTimeSlices = db.getTravelRequestBetween(start, end, line)

                for count in enumerate(requestBetweenTimeSlices, start=1):
                    countingNoOfRequest = (count[0])

                try:
                    finalNoReqBetweenTimeSlice = countingNoOfRequest
                except:
                    print("No requests found for the particular date you desire")
                Fitness.totalRequestsBusline[(line, start, end)] = finalNoReqBetweenTimeSlice
Example #2
0
 def runOnce(self):
     db = DB()
     # Setting the start time boundary of request that we want
     startTime = datetime.datetime.combine(Fitness.yesterday, datetime.datetime.strptime(Fitness.firstMinute, Fitness.formatTime).time())
     endTime = datetime.datetime.combine(Fitness.yesterday, datetime.datetime.strptime(Fitness.lastMinute, Fitness.formatTime).time())
     # Create index for the people going on the bus
     Fitness.request = db.grpReqByBusstopAndTime(startTime, endTime)
     self.createRequestIndex(Fitness.request)
     # Create index for the people going down the bus
     Fitness.requestOut = db.getReqCountByEndBusStop(startTime, endTime)
     self.createRequestIndexOut(Fitness.requestOut)
     '''
Example #3
0
 def runOnce(self):
     db = DB()
     # Setting the start time boundary of request that we want
     startTime = datetime.datetime.combine(
         Fitness.yesterday,
         datetime.datetime.strptime(Fitness.firstMinute,
                                    Fitness.formatTime).time())
     endTime = datetime.datetime.combine(
         Fitness.yesterday,
         datetime.datetime.strptime(Fitness.lastMinute,
                                    Fitness.formatTime).time())
     # Create index for the people going on the bus
     Fitness.request = db.grpReqByBusstopAndTime(startTime, endTime)
     self.createRequestIndex(Fitness.request)
     # Create index for the people going down the bus
     Fitness.requestOut = db.getReqCountByEndBusStop(startTime, endTime)
     self.createRequestIndexOut(Fitness.requestOut)
     '''