This repository has been archived on 2024-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
db-manager/src/helpers.py
Fred Boniface 0f7693d798 Bug Fixes:
- Out of date schedules were not being removed from timetable
 - Timetable update was at risk of missing a day
 - cif-data file was not being removed after mailing - mainly an issue when not containerized
 - Added additional helper variables
2023-06-07 21:14:49 +01:00

27 lines
725 B
Python

import time, os
## Environment Options
env_corpus_user = os.getenv('OWL_LDB_CORPUSUSER')
env_corpus_pass = os.getenv('OWL_LDB_CORPUSPASS')
## Timetable Data Options
required_toc_codes = ["EF"]
## PIS Data Options
pis_file_paths = [
"/app/data/pis/gwr.yaml"
]
## Upstream Data URLs
corpus_data_url = "https://publicdatafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS"
## Time Constants
one_day_in_seconds = (60**2)*24
twenty_hours = (60**2)*20
two_day_in_seconds = one_day_in_seconds * 2
two_weeks_in_seconds = one_day_in_seconds * 14
def getAgeInSeconds(updateTimeInSeconds :int):
now = int(time.time())
ageInSeconds :int = now - updateTimeInSeconds
return ageInSeconds