Skip to content

Commit a80197f

Browse files
authored
Update parking_correspondence_performance_records_with_pcn_downtime_gds.py
updated downtime records for t_team details to pull from parking_correspondence_performance_teams instead on leaving blank
1 parent 7cba795 commit a80197f

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

scripts/jobs/parking/parking_correspondence_performance_records_with_pcn_downtime_gds.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ def sparkSqlQuery(glueContext, query, mapping, transformation_ctx) -> DynamicFra
6363
02/10/2023 - modified to union data into one output for Downtime data gathered from Google form https://forms.gle/bB53jAayiZ2Ykwjk6
6464
08/11/2023 - modified to add monthly officer totals from original gds job
6565
06/11/2024 - updated date formats in downtime data as source google sheet changed to yyyy-mm-dd HH:MM:ss from d/m/y
66+
28/11/2024 - updated downtime records for t_team details to pull from parking_correspondence_performance_teams instead on leaving blank
6667
6768
*/
69+
6870
/*Teams data from google spreadsheet load - https://docs.google.com/spreadsheets/d/1zxZXX1_qU9NW93Ug1JUy7aXsnTz45qIj7Zftmi9trbI/edit?usp=sharing*/
6971
With officer_total_rep_dates as(
7072
select
@@ -414,8 +416,8 @@ def sparkSqlQuery(glueContext, query, mapping, transformation_ctx) -> DynamicFra
414416
Select
415417
cast(parking_officer_downtime.timestamp as string) as downtime_timestamp
416418
,email_address as downtime_email_address
417-
,officer_s_first_name
418-
,officer_s_last_name
419+
,TRIM(officer_s_first_name) as officer_s_first_name
420+
,TRIM(officer_s_last_name) as officer_s_last_name
419421
,liberator_system_username
420422
,liberator_system_id
421423
,cast(import_datetime as string) import_datetime
@@ -486,7 +488,7 @@ def sparkSqlQuery(glueContext, query, mapping, transformation_ctx) -> DynamicFra
486488
,'Downtime' as Type
487489
,parking_officer_downtime.Downtime as Serviceable -- downtime
488490
,'' as Service_category
489-
,concat(officer_s_first_name,' ',officer_s_last_name) as Response_written_by --downtime officer full name
491+
,concat(TRIM(officer_s_first_name),' ',TRIM(officer_s_last_name)) as Response_written_by --downtime officer full name
490492
,'' as Letter_template
491493
,'' as Action_taken
492494
,'' as Related_to_PCN
@@ -626,21 +628,23 @@ def sparkSqlQuery(glueContext, query, mapping, transformation_ctx) -> DynamicFra
626628
,'' as tot_rep_records
627629
628630
/*Teams data*/
629-
,'' as t_start_date
630-
,'' as t_end_date
631-
,'' as t_team
632-
,'' as t_team_name
633-
,'' as t_role
634-
,'' as t_forename
635-
,'' as t_surname
636-
,'' as t_full_name
637-
,'' as t_qa_doc_created_by
638-
,'' as t_qa_doc_full_name
639-
,'' as t_post_title
640-
,'' as t_notes
641-
,'' as t_import_date
642-
643-
from parking_officer_downtime where import_date = (select max(import_date) from parking_officer_downtime) and timestamp not like '' and timestamp not like '#REF!'
631+
,t_start_date
632+
,t_end_date
633+
,t_team
634+
,t_team_name
635+
,t_role
636+
,t_forename
637+
,t_surname
638+
,t_full_name
639+
,t_qa_doc_created_by
640+
,t_qa_doc_full_name
641+
,t_post_title
642+
,t_notes
643+
,t_import_date
644+
645+
from parking_officer_downtime
646+
left join team on upper(team.t_full_name) = upper(concat(TRIM(officer_s_first_name),' ',TRIM(officer_s_last_name))) --as Response_written_by --downtime officer full name
647+
where import_date = (select max(import_date) from parking_officer_downtime) and timestamp not like '' and timestamp not like '#REF!'
644648
AND cast(Substr( cast(parking_officer_downtime.timestamp as string) ,1,10) as date) > current_date - interval '13' month --Last 13 months from todays date
645649
--order by timestamp desc
646650
"""

0 commit comments

Comments
 (0)