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

27 lines
725 B
Python
Raw Normal View History

2023-06-06 13:11:54 +01:00
import time, os
2023-06-03 21:05:35 +01:00
2023-06-06 13:11:54 +01:00
## 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
2023-06-06 13:11:54 +01:00
two_day_in_seconds = one_day_in_seconds * 2
two_weeks_in_seconds = one_day_in_seconds * 14
2023-06-03 21:05:35 +01:00
def getAgeInSeconds(updateTimeInSeconds :int):
now = int(time.time())
ageInSeconds :int = now - updateTimeInSeconds
return ageInSeconds