Mengekstrak data dalam katalog AWS Glue data Anda untuk analitik panggilan Amazon SDK Chime - Amazon Chime SDK

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Mengekstrak data dalam katalog AWS Glue data Anda untuk analitik panggilan Amazon SDK Chime

Gunakan contoh kueri ini untuk mengekstrak dan mengatur data dalam katalog data SDK Glue analitik panggilan Amazon Chime Anda.

catatan

Untuk informasi tentang menghubungkan ke Amazon Athena dan menanyakan katalog data Glue Anda, lihat Menyambung ke Amazon Athena dengan. ODBC

Perluas setiap bagian sesuai kebutuhan.

call_analytics_metadatamemiliki metadata bidang dalam format JSON string. Gunakan fungsi json_extract_scalar di Athena untuk menanyakan elemen dalam string ini.

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"

call_analytics_metadataBidang ini memiliki bidang metadata dalam format JSON string. metadatamemiliki objek bersarang lain yang disebutoneTimeMetadata, objek ini berisi SIPRec Metadata dalam format asli XML dan diubah. JSON Gunakan json_extract_scalar fungsi di Athena untuk query elemen dalam string ini.

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_metadatamemiliki bidang metadata dalam format JSON string. Gunakan fungsi json_extract_scalar di Athena untuk menanyakan elemen dalam string ini.

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_statusmemiliki bidang detail dalam tipe struct data. Contoh berikut menunjukkan bagaimana untuk query bidang tipe struct data:

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"

Contoh query berikut bergabung call_analytics_metadata danvoice_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 memiliki bidang transkrip dalam format struct dengan array bersarang. Gunakan kueri berikut untuk menghapus sarang 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)

Kueri berikut bergabung dengan transcribe_call_analytics_post_call dan 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

Contoh query berikut bergabung Voice enhancement call recordingURL:

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"