Skip to content

Commit 979537c

Browse files
Merge pull request #10 from cityofaustin/charlie/locations
add Maximo service address to dataset
2 parents f0aef5f + 88693b5 commit 979537c

3 files changed

Lines changed: 21 additions & 14 deletions

File tree

env_template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Socrata aka City datahub
1+
# Socrata aka City datahub (1pass: Socrata Key ID, Secret, and Token)
22
SO_KEY=
33
SO_SECRET=
44
SO_TOKEN=
55
SO_WEB=
66

7-
# Maximo Data Warehouse DB
7+
# Maximo Data Warehouse DB (1pass: Maximo Data Warehouse)
88
MAXIMO_DB_PASS=
99
MAXIMO_DB_USER=
1010
MAXIMO_HOST=

etl/queries.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
w.OUTMATCOST,
3535
w.OUTTOOLCOST,
3636
w.WOPRIORITY,
37-
lkp.DESCRIPTION AS PROBLEMCODE,
38-
lkf.DESCRIPTION AS FAILURECODE,
37+
lkp.DESCRIPTION AS PROBLEMCODE,
38+
lkf.DESCRIPTION AS FAILURECODE,
3939
w.HASFOLLOWUPWORK,
4040
w.SENDERSYSID,
4141
w.ORGID,
@@ -54,16 +54,18 @@
5454
w.CSR311NUMBER,
5555
w.ROW_PERMIT,
5656
w.ROW_EXPDATE,
57-
l.NUMVALUE AS CTM_SEGMENT_ID,
58-
w.DIM_OWNER_PERSON_SK,
57+
l.NUMVALUE AS CTM_SEGMENT_ID,
58+
w.DIM_OWNER_PERSON_SK,
5959
w.SUPERINTENDENT,
6060
w.REPORTEDBY,
6161
w.DIM_LEAD_PERSON_SK,
6262
w.HOLDREASON,
63-
cc.DESCRIPTION AS CAUSE,
64-
rc.DESCRIPTION AS REMEDY,
63+
cc.DESCRIPTION AS CAUSE,
64+
rc.DESCRIPTION AS REMEDY,
6565
w.ALTREF,
66-
'{base_url}' || w.WONUM as WO_LINK
66+
wosa.DESCRIPTION AS SERVICE_ADDRESS,
67+
wosa.SADDRESSCODE AS SERVICE_ADDRESS_CODE,
68+
'{base_url}' || w.WONUM AS WO_LINK
6769
FROM MAXIMO_DM.FCT_WORKORDER w
6870
LEFT OUTER JOIN (SELECT *
6971
FROM MAXIMO_DM.DIM_LOCATIONSPEC
@@ -82,6 +84,11 @@
8284
WHERE TYPE = 'REMEDY') rc ON rc.WONUM = w.WONUM
8385
LEFT JOIN MAXIMO_DM.LKP_FAILURECODE lkp ON lkp.FAILURECODE = w.PROBLEMCODE
8486
LEFT JOIN MAXIMO_DM.LKP_FAILURECODE lkf ON lkf.FAILURECODE = w.FAILURECODE
87+
LEFT JOIN (SELECT WONUM,
88+
DESCRIPTION,
89+
SADDRESSCODE
90+
FROM MAXIMO_DM.DIM_WOSERVICEADDRESS
91+
WHERE SITEID = 'SBO') wosa ON w.WONUM = wosa.WONUM
8592
WHERE w.SITEID = 'SBO'
8693
AND w.CHANGEDATE BETWEEN TO_DATE('{start}', 'MM/DD/YYYY')
8794
AND TO_DATE('{end}', 'MM/DD/YYYY')

readme.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ The three parameters this script takes is `--start`, `--end`, and `--query`, the
1212

1313
Publishing work orders to the city datahub between August 31st, 2023 and September 9th, 2023:
1414

15-
`$ python etl/maximo_to_socrata.py --query work_orders --start 2023-08-31 --end 2023-09-09`
15+
`python etl/maximo_to_socrata.py --query work_orders --start 2023-08-31 --end 2023-09-09`
1616

1717
Leaving out `--start` will default to 7 days ago. Leaving out `--end` will default to today. Publishing the work orders for the past week:
1818

19-
`$ python etl/maximo_to_socrata.py --query work_orders`
19+
`python etl/maximo_to_socrata.py --query work_orders`
2020

2121
The `--query` determines which query `etl/queries.py` (defined as QUERIES) is run. All queries configured there must take `--start` and `--end` arguments.
2222

@@ -28,14 +28,14 @@ Note that you also must be on the City network to be able to access the Maximo d
2828

2929
This repo can be used with a docker container. You can either build it yourself with:
3030

31-
`$ docker build . -t dts-maximo-reporting:production`
31+
`docker build . -t dts-maximo-reporting:production`
3232

3333
or pull from our dockerhub account:
3434

35-
`$ docker pull atddocker/dts-maximo-reporting:production`
35+
`docker pull atddocker/dts-maximo-reporting:production`
3636

3737
Then, provide the environment variables described in env_template to the docker image:
3838

39-
`$ docker run -it --env-file env_file dts-maximo-reporting:production /bin/bash`
39+
`docker run -it --env-file env_file dts-maximo-reporting:production /bin/bash`
4040

4141
Then, provide the command you would like to run.

0 commit comments

Comments
 (0)