2022-10-31 03:49:13 -04:00
|
|
|
Following instructions assume that code is placed within `~/colouring-london/etl/planning_data/`
|
|
|
|
|
2022-11-05 03:30:07 -04:00
|
|
|
To install necessary dependencies use `cd ~/colouring-london/etl/planning_data/ && pip3 install -r requirements.txt`
|
2022-10-31 03:49:13 -04:00
|
|
|
|
2022-10-05 13:52:14 -04:00
|
|
|
Following scripts should be scheduled to run regularly to load livestream data into database.
|
|
|
|
|
|
|
|
```
|
2022-10-31 03:49:13 -04:00
|
|
|
# querying API to obtain data & loading data into Colouring database
|
|
|
|
python3 obtain_livestream_data_and_load_into_database.py
|
2022-10-05 13:52:14 -04:00
|
|
|
|
2022-12-02 09:28:50 -05:00
|
|
|
# removing tile cache for planning applications status layers - note that location of cache depends on your configuration
|
|
|
|
rm /srv/colouring-london/tilecache/planning_applications_status_all/* -rf
|
|
|
|
rm /srv/colouring-london/tilecache/planning_applications_status_recent/* -rf
|
|
|
|
rm /srv/colouring-london/tilecache/planning_applications_status_very_recent/* -rf
|
2022-10-05 13:52:14 -04:00
|
|
|
```
|
|
|
|
|
2022-08-30 09:23:54 -04:00
|
|
|
As loading into databases expects environment variables to be set, one option to actually schedule it in a cron is something like
|
2022-10-05 13:52:14 -04:00
|
|
|
|
|
|
|
```
|
2022-10-31 03:49:13 -04:00
|
|
|
export $(cat ~/scripts/.env | xargs) && /usr/bin/python3 ~/colouring-london/etl/planning_data/obtain_livestream_data_and_load_into_database.py
|
2022-10-05 13:52:14 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
with
|
|
|
|
|
|
|
|
```
|
2022-09-14 06:07:33 -04:00
|
|
|
~/scripts/.env
|
2022-10-05 13:52:14 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
being in following format
|
|
|
|
|
|
|
|
```
|
|
|
|
PGHOST=localhost
|
|
|
|
PGDATABASE=colouringlondondb
|
|
|
|
PGUSER=cldbadmin
|
|
|
|
PGPASSWORD=actualpassword
|
2022-10-31 03:49:13 -04:00
|
|
|
PLANNNING_DATA_API_ALLOW_REQUEST_CODE=requestcode
|
|
|
|
```
|