GSP-311 : Automate Interactions with Contact Center AI: Challenge Lab

GSP-311 : Automate Interactions with Contact Center AI: Challenge Lab

Overview

Please do the following steps to complete this lab:

1export PROJECT=$(gcloud info --format='value(config.project)')
2git clone https://github.com/GoogleCloudPlatform/dataflow-contact-center-speech-analysis.git
  • Task - 1 : Create a Regional Cloud Storage bucket
1gsutil mb -p ${PROJECT} -l  us-central1 gs://${PROJECT}-a
  • Task - 2 : Create a Cloud Function
1gcloud functions deploy safLongRunJobFunc \
2  --region us-central1 \
3  --trigger-resource gs://${PROJECT}-a \
4  --trigger-event google.storage.object.finalize \
5  --stage-bucket gs://${PROJECT}-a \
6  --source dataflow-contact-center-speech-analysis/saf-longrun-job-func \
7  --runtime nodejs10
  • Task - 3 : Create a BigQuery Dataset
1bq mk helpdesk
  • Task - 4 : Create Cloud Pub/Sub Topic
1gcloud pubsub topics create helpdesk
  • Task - 5 : Create a Cloud Storage Bucket for Staging Contents
1gsutil mb -p ${PROJECT} -l  us-central1 gs://${PROJECT}-t
2mkdir DFaudio
3touch DFaudio/test
4gsutil cp -r DFaudio gs://${PROJECT}-t
  • Task - 6 : Deploy a Cloud Dataflow Pipeline
 1python -m virtualenv env -p python3
 2source env/bin/activate
 3pip install apache-beam[gcp]
 4pip install dateparser
 5pip install Cython
 6
 7cd dataflow-contact-center-speech-analysis/saf-longrun-job-dataflow/
 8export PROJECT=$(gcloud info --format='value(config.project)')
 9python3 saflongrunjobdataflow.py \
10    --project ${PROJECT} \
11    --runner DataflowRunner \
12    --region us-central1 \
13    --temp_location gs://${PROJECT}-t/tmp \
14    --input_topic projects/${PROJECT}/topics/helpdesk \
15    --output_bigquery ${PROJECT}:helpdesk.realtime \
16    --requirements_file "requirements.txt"
17
18gcloud dataflow jobs list --region=us-central1
  • Task - 7 : Upload Sample Audio Files for Processing :-
1# mono flac audio sample
2gsutil -h x-goog-meta-callid:1234567 -h x-goog-meta-stereo:false -h x-goog-meta-pubsubtopicname:helpdesk -h x-goog-meta-year:2019 -h x-goog-meta-month:11 -h x-goog-meta-day:06 -h x-goog-meta-starttime:1116 cp gs://qwiklabs-bucket-gsp311/speech_commercial_mono.flac gs://${PROJECT}-a
3
4# stereo wav audio sample
5gsutil -h x-goog-meta-callid:1234567 -h x-goog-meta-stereo:true -h x-goog-meta-pubsubtopicname:helpdesk -h x-goog-meta-year:2019 -h x-goog-meta-month:11 -h x-goog-meta-day:06 -h x-goog-meta-starttime:1116 cp gs://qwiklabs-bucket-gsp311/speech_commercial_stereo.wav gs://${PROJECT}-a
  • Task - 8 : Run a Data Loss Prevention Job
1select * from (SELECT entities.name,entities.type, COUNT(entities.name) AS count FROM saf.transcripts, UNNEST(entities) entities GROUP BY entities.name, entities.type ORDER BY count ASC ) Where count > 5

Click “Save Query Results” and select “BigQuery table” option. Enter a name for a new table and save. Go to the new table in which result is saved and then Click on Export > Scan with DLP

Congratulations, you're all done with the lab 😄