Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Estrazione di dati dal catalogo AWS Glue dati per l'analisi delle chiamate di Amazon SDK Chime
Usa queste query di esempio per estrarre e organizzare i dati nel tuo catalogo di dati Amazon SDK Chime Call Analytics Glue.
Nota
Per informazioni sulla connessione ad Amazon Athena e sull'interrogazione del catalogo dati Glue, consulta Connessione ad Amazon Athena con. ODBC
Espandi ogni sezione in base alle esigenze.
call_analytics_metadata
ha il JSON campo in formato stringa. metadata
Usa la funzione json_extract_scalar in Athena per interrogare gli elementi di questa stringa.
SELECT json_extract_scalar(metadata,'$.voiceConnectorId') AS "VoiceConnector ID", json_extract_scalar(metadata,'$.fromNumber') AS "From Number", json_extract_scalar(metadata,'$.toNumber') AS "To Number", json_extract_scalar(metadata,'$.callId') AS "Call ID", json_extract_scalar(metadata,'$.direction') AS Direction, json_extract_scalar(metadata,'$.transactionId') AS "Transaction ID" FROM "GlueDatabaseName"."call_analytics_metadata"
Il campo contiene il call_analytics_metadata
campo dei metadati in formato stringa. JSON metadata
ha un altro oggetto annidato chiamatooneTimeMetadata
, questo oggetto contiene SIPRec metadati in formati originali XML e trasformati. JSON Usa la json_extract_scalar
funzione in Athena per interrogare gli elementi di questa stringa.
SELECT json_extract_scalar(metadata,'$.voiceConnectorId') AS "VoiceConnector ID", json_extract_scalar(metadata,'$.fromNumber') AS "From Number", json_extract_scalar(metadata,'$.toNumber') AS "To Number", json_extract_scalar(metadata,'$.callId') AS "Call ID", json_extract_scalar(metadata,'$.direction') AS Direction, json_extract_scalar(metadata,'$.transactionId') AS "Transaction ID", json_extract_scalar(json_extract_scalar(metadata,'$.oneTimeMetadata'),'$.siprecMetadata') AS "siprec Metadata XML", json_extract_scalar(json_extract_scalar(metadata,'$.oneTimeMetadata'),'$.siprecMetadataJson') AS "Siprec Metadata JSON", json_extract_scalar(json_extract_scalar(metadata,'$.oneTimeMetadata'),'$.inviteHeaders') AS "Invite Headers" FROM "GlueDatabaseName"."call_analytics_metadata" WHERE callevent-type = "update";
call_analytics_recording_metadata
ha il campo dei JSON metadati in formato stringa. Usa la funzione json_extract_scalar in Athena per interrogare gli elementi di questa stringa.
SELECT json_extract_scalar(metadata,'$.voiceConnectorId') AS "VoiceConnector ID", json_extract_scalar(metadata,'$.fromNumber') AS "From Number", json_extract_scalar(metadata,'$.toNumber') AS "To Number", json_extract_scalar(metadata,'$.callId') AS "Call ID", json_extract_scalar(metadata,'$.direction') AS Direction, json_extract_scalar(metadata,'$.transactionId') AS "Transaction ID" FROM "GlueDatabaseName"."call_analytics_recording_metadata" WHERE detail-subtype = "Recording"
voice_analytics_status
ha un campo di dettagli nel tipo di datistruct
. L'esempio seguente mostra come interrogare un campo di tipo di struct
dati:
SELECT detail.transactionId AS "Transaction ID", detail.voiceConnectorId AS "VoiceConnector ID", detail.siprecmetadata AS "Siprec Metadata", detail.inviteheaders AS "Invite Headers", detail.streamStartTime AS "Stream Start Time" FROM "GlueDatabaseName"."voice_analytics_status"
La seguente query di esempio unisce e: call_analytics_metadata
voice_analytics_status
SELECT a.detail.transactionId AS "Transaction ID", a.detail.voiceConnectorId AS "VoiceConnector ID", a.detail.siprecmetadata AS "Siprec Metadata", a.detail.inviteheaders AS "Invite Headers", a.detail.streamStartTime AS "Stream Start Time" json_extract_scalar(b.metadata,'$.fromNumber') AS "From Number", json_extract_scalar(b.metadata,'$.toNumber') AS "To Number", json_extract_scalar(b.metadata,'$.callId') AS "Call ID", json_extract_scalar(b.metadata,'$.direction') AS Direction FROM "GlueDatabaseName"."voice_analytics_status" a INNER JOIN "GlueDatabaseName"."call_analytics_metadata" b ON a.detail.transactionId = json_extract_scalar(b.metadata,'$.transactionId')
transcribe_call_analytics_post_call ha un campo di trascrizione in formato struct con array annidati. Utilizzate la seguente query per rimuovere l'annidamento degli array:
SELECT jobstatus, languagecode, IF(CARDINALITY(m.transcript)=0 OR CARDINALITY(m.transcript) IS NULL, NULL, e.transcript.id) AS utteranceId, IF(CARDINALITY(m.transcript)=0 OR CARDINALITY(m.transcript) IS NULL, NULL, e.transcript.content) AS transcript, accountid, channel, sessionid, contentmetadata.output AS "Redaction" FROM "GlueDatabaseName"."transcribe_call_analytics_post_call" m CROSS JOIN UNNEST (IF(CARDINALITY(m.transcript)=0, ARRAY[NULL], transcript)) AS e(transcript)
La seguente query unisce transcribe_call_analytics_post_call e call_analytics_metadata:
WITH metadata AS( SELECT from_iso8601_timestamp(time) AS "Timestamp", date_parse(date_format(from_iso8601_timestamp(time), '%m/%d/%Y %H:%i:%s') , '%m/%d/%Y %H:%i:%s') AS "DateTime", date_parse(date_format(from_iso8601_timestamp(time) , '%m/%d/%Y') , '%m/%d/%Y') AS "Date", date_format(from_iso8601_timestamp(time) , '%H:%i:%s') AS "Time", mediainsightspipelineid, json_extract_scalar(metadata,'$.toNumber') AS "To Number", json_extract_scalar(metadata,'$.voiceConnectorId') AS "VoiceConnector ID", json_extract_scalar(metadata,'$.fromNumber') AS "From Number", json_extract_scalar(metadata,'$.callId') AS "Call ID", json_extract_scalar(metadata,'$.direction') AS Direction, json_extract_scalar(metadata,'$.transactionId') AS "Transaction ID", REGEXP_REPLACE(REGEXP_EXTRACT(json_extract_scalar(metadata,'$.oneTimeMetadata.s3RecordingUrl'), '[^/]+(?=\.[^.]+$)'), '\.wav$', '') AS "SessionID" FROM "GlueDatabaseName"."call_analytics_metadata" ), transcript_events AS( SELECT jobstatus, languagecode, IF(CARDINALITY(m.transcript)=0 OR CARDINALITY(m.transcript) IS NULL, NULL, e.transcript.id) AS utteranceId, IF(CARDINALITY(m.transcript)=0 OR CARDINALITY(m.transcript) IS NULL, NULL, e.transcript.content) AS transcript, accountid, channel, sessionid, contentmetadata.output AS "Redaction" FROM "GlueDatabaseName"."transcribe_call_analytics_post_call" m CROSS JOIN UNNEST (IF(CARDINALITY(m.transcript)=0, ARRAY[NULL], transcript)) AS e(transcript) ) SELECT jobstatus, languagecode, a.utteranceId, transcript, accountid, channel, a.sessionid, "Redaction" "Timestamp", "DateTime", "Date", "Time", mediainsightspipelineid, "To Number", "VoiceConnector ID", "From Number", "Call ID", Direction, "Transaction ID" FROM "GlueDatabaseName"."transcribe_call_analytics_post_call" a LEFT JOIN metadata b ON a.sessionid = b.SessionID
Il seguente esempio di query si unisce: Voice enhancement call recording
URL
SELECT json_extract_scalar(metadata,'$.voiceConnectorId') AS "VoiceConnector ID", json_extract_scalar(metadata,'$.fromNumber') AS "From Number", json_extract_scalar(metadata,'$.toNumber') AS "To Number", json_extract_scalar(metadata,'$.callId') AS "Call ID", json_extract_scalar(metadata,'$.direction') AS Direction, json_extract_scalar(metadata,'$.transactionId') AS "Transaction ID", s3MediaObjectConsoleUrl FROM {GlueDatabaseName}."call_analytics_recording_metadata" WHERE detail-subtype = "VoiceEnhancement"