From 0aeb4130c37d145fc13b972cdffcec36f01a97f5 Mon Sep 17 00:00:00 2001 From: Anna Saiapina Date: Wed, 22 May 2024 14:54:30 +0000 Subject: [PATCH] Part of calls --- definitions/staging/stg_calls.sqlx | 233 +++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 definitions/staging/stg_calls.sqlx diff --git a/definitions/staging/stg_calls.sqlx b/definitions/staging/stg_calls.sqlx new file mode 100644 index 0000000..5f7b399 --- /dev/null +++ b/definitions/staging/stg_calls.sqlx @@ -0,0 +1,233 @@ +config { + type: "table", + schema: "pphe_five9_stg", + assertions: { + uniqueKey: ["SESSION_ID", "TIMESTAMP", "DNIS"], + nonNull: ["CALL_ID", "AGENT_GROUP_ID", "DISPOSITION_ID",, "DISPOSITION_GROUP_ID", + "DISPOSITION_GROUP", "CAMPAIGN_ID", "CAMPAIGN_GROUP_ID", + "CAMPAIGN_GROUP", "SKILL_ID"] + }, + tags: ["daily"], + description: "CALLS data with mappings" +} + + +select cl."DAY OF WEEK" DAY_OF_WEEK, + cl."CALL ID" CALL_ID, + cl.CAMPAIGN, + cl.SKILL, + cl.DISPOSITION, + cl."AGENT NAME" AGENT_NAME, + cl.ANI, + cl."CALL TIME" CALL_TIME, + cl."RING TIME" RING_TIME, + cl."TALK TIME" TALK_TIME, + cl."AFTER CALL WORK TIME" AFTER_CALL_WORK_TIME, + cl.ABANDONED, + cl."AGENT GROUP" AGENT_GROUP, + cl.CALLS, + cl."SPEED OF ANSWER" SPEED_OF_ANSWER, + cl."TIME TO ABANDON" TIME_TO_ABANDON, + cl.TIMESTAMP, + cl."TIME INTERVAL" TIME_INTERVAL, + cl."ABANDON RATE" ABANDON_RATE, + cl."ANI AREA CODE" ANI_AREA_CODE, + cl."ANI COUNTRY" ANI_COUNTRY, + cl."ANI COUNTRY CODE" ANI_COUNTRY_CODE, + cl."ANI STATE" ANI_STATE, + cl."CALL SURVEY RESULT" CALL_SURVEY_RESULT, + cl."CALL TYPE" , + cl."CALLS COMPLETED IN IVR" , + cl."CALLS TIMED OUT IN IVR" , + cl."CAMPAIGN TYPE" , + cl.CONTACTED, + cl."DIAL RESULT" , + cl."DISCONNECTED FROM HOLD" , + cl."DISPOSITION GROUP A" , + cl."DISPOSITION GROUP B" , + cl."DISPOSITION GROUP C" , + cl."DISPOSITION PATH" , + cl.DNIS, + cl."DNIS AREA CODE" , + cl."DNIS COUNTRY" , + cl."DNIS COUNTRY CODE" , + cl."DNIS STATE" , + cl."LIST NAME" , + cl."LIVE CONNECT" , + cl."NO PARTY CONTACT" , + cl.NOTES, + cl."PARENT SESSION ID" , + cl."SERVICE LEVEL" , + cl."SESSION ID" , + cl."SIP RESPONSE CODE" , + cl."SOA MIN_THRESHOLD _sec_" , + cl."3RD PARTY TALK TIME" , + cl."BILL TIME _ROUNDED_" , + cl."CONFERENCE TIME" , + cl.CONFERENCES, + cl."CONSULT TIME" , + cl.COST, + cl."DIAL TIME" , + cl."HANDLE TIME" , + cl."HOLD TIME" , + cl.HOLDS, + cl."IVR TIME" , + cl."MANUAL TIME" , + cl."PARK TIME" , + cl.PARKS, + cl."PREVIEW INTERRUPTED" , + cl."PREVIEW INTERRUPTED BY CALL" , + cl."PREVIEW INTERRUPTED BY SKILL VM" , + cl."PREVIEW TIME" , + cl."QUEUE CALLBACK PROCESSING" , + cl."QUEUE CALLBACK REGISTERED" , + cl."QUEUE CALLBACK WAIT TIME" , + cl."QUEUE WAIT TIME" , + cl.RATE, + cl."TALK TIME LESS HOLD AND PARK" , + cl."TOTAL QUEUE TIME" , + cl.TRANSFERS, + cl."VIDEO TIME" , + cl.AGENT, + cl."AGENT EMAIL" , + cl."AGENT FIRST NAME" , + cl."AGENT ID" , + cl."AGENT LAST NAME" , + cl."DEST AGENT" , + cl."DEST AGENT EMAIL" , + cl."DEST AGENT EXTENSION" , + cl."DEST AGENT FIRST NAME" , + cl."DEST AGENT GROUP" , + cl."DEST AGENT LAST NAME" , + cl."DEST AGENT NAME" , + cl.EXTENSION, + cl.city, + cl.company, + cl."CONTACT CREATE TIMESTAMP" , + cl."CONTACT ID" , + cl."CONTACT MODIFIED TIMESTAMP" , + cl.Country, + cl.email, + cl."Email Skill" , + cl.Email_ID, + cl."Event Planning" , + cl.Facebook_ID, + cl."Hotel ME Number" , + cl."Hotel Name" , + cl."Hotel Operator Number" , + cl.Intent, + cl."Last Agent" , + cl."Last Agent Disposition" , + cl."Last Campaign" , + cl."Last Disposition" , + cl."Last Stay" , + cl."Last System Disposition" , + cl."Membership Codes" , + cl."Membership Number" , + cl."Memberships - Descriptions" , + cl."New Contact Created" , + cl.number1, + cl.number2, + cl.number3, + cl."Option selected by Customer" , + cl.Prompt, + cl.state, + cl.street, + cl.SurveyID, + cl.Twitter_ID, + cl.Webchat_ID, + cl.WhatsApp_ID, + cl.zip, + cl.VOICEMAILS, + cl."VOICEMAILS DECLINED" , + cl."VOICEMAILS DELETED" , + cl."VOICEMAILS HANDLE TIME" , + cl."VOICEMAILS HANDLED" , + cl."VOICEMAILS RETURNED CALL" , + cl."VOICEMAILS TRANSFERRED" , + cl."Call_campaign_name" , + cl."Email Classification_Category" , + cl."Email Classification_Length" , + cl."Email Classification_Request" , + cl."Email Classification_ReviewPro" , + cl."Email Classification_Sentiment" , + cl."Email Classification_Sentiment Success" , + cl."Email Classification_Success" , + cl."Flags_Send to Intelliagent" , + cl."Flags_Sender MChat" , + cl."IVA Reporting_X-df_matched_intent_1" , + cl."IVA Reporting_X-df_matched_intent_2" , + cl."IVA Reporting_X-df_matched_intent_3" , + cl."IVA Reporting_X-df_matched_intent_4" , + cl."IVA Reporting_X-df_matched_intent_5" , + cl."IVA Reporting_X-df_matched_intent_6" , + cl."IVA Reporting_X-df_matched_intent_7" , + cl."IVA Reporting_X-df_matched_intent_8" , + cl."IVA Reporting_X-df_matched_intent_9" , + cl."IVA Reporting_X-of_iva_transcription_1" , + cl."IVA Reporting_X-of_iva_transcription_2" , + cl."IVA Reporting_X-of_iva_transcription_3" , + cl."IVA Reporting_X-of_iva_transcription_4" , + cl."IVA Reporting_X-of_iva_transcription_5" , + cl."IVA Reporting_X-of_iva_transcription_6" , + cl."IVA Reporting_X-of_iva_transcription_7" , + cl."IVA Reporting_X-of_iva_transcription_8" , + cl."IVA Reporting_X-of_iva_transcription_9" , + cl."IVA_Booking Size" , + cl."IVA_Customer Intent 1" , + cl."IVA_Customer Intent 2" , + cl."IVA_Customer Intent 3" , + cl."IVA_Last Intent" , + cl."IVA_New Booking" , + cl."IVA_Number of Rooms" , + cl."IVA_Rewards Member" , + cl."IVA_Route Decision" , + cl."IVA_Route Reason" , + cl."IVA_Route Type" , + cl."IVA_Route Value" , + cl."Omni_email" , + cl."Omni_name" , + cl."Omni_source" , + cl."Omni_subject" , + cl."Routing_Agent Name" , + cl."Routing_Bedroom Reservations Menu" , + cl."Routing_Email" , + cl."Routing_Email Sender debug" , + cl."Routing_from Guest Services" , + cl."Routing_GME Languages" , + cl."Routing_Group Reservations Menu" , + cl."Routing_Hotel Name" , + cl."Routing_Hotel Operator Number" , + cl."Routing_Hotel Questions Menu" , + cl."Routing_Initial Menu" , + cl."Routing_Language Choice" , + cl."Routing_Last Agent" , + cl."Routing_ME Sales Group Menu" , + cl."Routing_OOH" , + cl."Routing_OTA" , + cl."Routing_Prompt" , + cl."Routing_webchat_page" , + cl."Social_account" , + cl."Social_Category" , + cl."Social_socialId" , + cl."Studio_transfer_disposition" , + a.LANGUAGES, + a.CODE LANGUAUGE_ID, + a.AGENT_GROUP_ID, + d.DISPOSITION_ID, + d.DISPOSITION_GROUP_ID, + d.DISPOSITION_GROUP, + c.CAMPAIGN_ID, + c.CAMPAIGN_GROUP_ID, + c.CAMPAIGN_GROUP, + s.SKILL_ID, + c.CAMPAIGN_TYPE_ID, +from ${ref("calls")} cl +left join ${ref("stg_AGENT")} a +on cl.AGENT_ID = a.AGENT_ID +left join ${ref("stg_DISPOSITION")} d +on cl.DISPOSITION = d.DISPOSITION +left join ${ref("stg_CAMPAIGN")} c +on cl.CAMPAIGN = c.CAMPAIGN +left join ${ref("stg_MAPPING_SKILL")} s +on cl.SKILL = s.SKILL \ No newline at end of file