From d54ecf0733ecda4cd546dda4e0f01256471b344a Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Thu, 29 Jun 2023 20:24:57 +0100 Subject: [PATCH] Upgrade timetable to include ALL services, not just GWR --- src/pis.py | 2 +- src/reasonCodes.py | 2 +- src/timetable.py | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pis.py b/src/pis.py index 95eb81f..ded3570 100644 --- a/src/pis.py +++ b/src/pis.py @@ -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()): diff --git a/src/reasonCodes.py b/src/reasonCodes.py index e996327..f7c202a 100644 --- a/src/reasonCodes.py +++ b/src/reasonCodes.py @@ -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()): diff --git a/src/timetable.py b/src/timetable.py index 92f715b..fb3421c 100644 --- a/src/timetable.py +++ b/src/timetable.py @@ -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