in sam-app/lambda_functions/sfContactLensUtil.py [0:0]
def processContactLensTranscript(iItems, participants):
customerTranscripts = []
agentTranscripts = []
finalTranscripts = []
for iTranscript in iItems:
transcript = {}
transcript['id'] = iTranscript['Id']
transcript['participantId'] = iTranscript['ParticipantId'] # For now it's either AGENT or CUSTOMER
transcript['beginOffsetMillis'] = iTranscript['BeginOffsetMillis']
transcript['endOffsetMillis'] = iTranscript['EndOffsetMillis']
transcript['content'] = iTranscript['Content']
transcript['sentiment'] = iTranscript['Sentiment']
transcript['loudness_score'] = iTranscript['LoudnessScore'] # array
if 'IssuesDetected' in iTranscript:
transcript['issues_detected'] = iTranscript['IssuesDetected']
if 'Redaction' in iTranscript:
transcript['redaction'] = iTranscript['Redaction']
finalTranscripts.append(transcript)
if iTranscript['ParticipantId'] == 'AGENT':
transcript['participantRole'] = getParticipantRole('AGENT', participants)
agentTranscripts.append(transcript)
elif iTranscript['ParticipantId'] == 'CUSTOMER':
transcript['participantRole'] = getParticipantRole('CUSTOMER', participants)
customerTranscripts.append(transcript)
return {'customerTranscripts' : customerTranscripts, 'agentTranscripts' : agentTranscripts, 'finalTranscripts': finalTranscripts}