Upgrade timetable to include ALL services, not just GWR

This commit is contained in:
Fred Boniface 2023-06-29 20:24:57 +01:00
parent 4debe98c18
commit d54ecf0733
3 changed files with 5 additions and 6 deletions

View File

@ -6,7 +6,7 @@ REBUILD :bool = False # Set to True to force rebuild
log.out("pis.py: PIS Module Loaded", "DBUG")
file_location :str = "/app/data/pis/gwr.yaml" # Production & Testing
file_location :str = "/home/fred.boniface/git/owlboard/db-manager/data/pis/gwr.yaml" # Local Development
#file_location :str = "/home/fred.boniface/git/owlboard/db-manager/data/pis/gwr.yaml" # Local Development
def runUpdate():
if (not requiresUpdate()):

View File

@ -7,7 +7,7 @@ REBUILD = False
log.out("reasonCodes.py: reasonCodes module initialised", "DBUG")
file_location :str = "/app/data/reasonCodes/reasoncodes.json" # Production & Testing
file_location :str = "/home/fred.boniface/git/owlboard/db-manager/data/reasonCodes/reasoncodes.json" # Local Development
#file_location :str = "/home/fred.boniface/git/owlboard/db-manager/data/reasonCodes/reasoncodes.json" # Local Development
def runUpdate():
if (not requiresUpdate()):

View File

@ -34,9 +34,8 @@ yesterdayDay = yesterday.strftime("%a").lower()
todayDay = now.strftime("%a").lower()
isAfter0800 = (int(now.strftime("%H")) >= 8)
filePath = "cif_data"
TOC_Code = "EF" # Business code for GWR
fullDataUrl = f"https://publicdatafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_{TOC_Code}_TOC_FULL_DAILY&day=toc-full"
updateDataUrl = f"https://publicdatafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_{TOC_Code}_TOC_UPDATE_DAILY&day=toc-update-{yesterdayDay}"
fullDataUrl = "https://publicdatafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full"
updateDataUrl = f"https://publicdatafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-update-{yesterdayDay}"
CORPUS_USER = os.getenv('OWL_LDB_CORPUSUSER')
CORPUS_PASS = os.getenv('OWL_LDB_CORPUSPASS')
@ -153,7 +152,7 @@ def _insertToDb(data :list, type :str):
create_transactions.append([item])
elif item['transactionType'] == "Delete":
mongo.deleteTimetableData({'trainUid': item['trainUid'], 'scheduleStartDate': item['scheduleStartDate'], 'stpIndicator': item['stpIndicator']})
mongo.putTimetable(create_transactions)
mongo.putTimetable(create_transactions)
post_count = mongo.getLength("timetable")
log.out(f"timetable._insertToDb: Document count difference after processing: {pre_count - post_count}", "DBUG")
return True #If Successfuls