o co@s$dZddlZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Z d"Z!d#Z"d$Z#d%Z$d&Z%d'Z&d(Z'd)Z(d*Z)d+Z*d,Z+d-Z,d.Z-d/Z.d0Z/d1Z0d2Z1e/e0e1gZ2hd3Z3d4Z4iZ5d5d6Z6d7d8Z7d9d:Z8d;d<Z9d=d>Z:e;d?kre7dSdS)@a This python function is part of the main processing workflow. It loads in all of the configuration parameters from the SSM Parameter Store and makes them available to all other python functions. It also includes some helper functions to check some logical conditions of some of these configuration parameters. Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 NZComprehendLanguagesZContentRedactionLanguagesZConversationLocationZEntityRecognizerEndpointZEntityStringMapZEntityThresholdZ EntityTypesZInputBucketAudioPlaybackZInputBucketNameZInputBucketRawAudioZInputBucketFailedTranscriptionsZInputBucketOrigTranscriptsZ MaxSpeakersZMinSentimentNegativeZMinSentimentPositiveZOutputBucketNameZOutputBucketTranscribeResultsZOutputBucketParsedResultsZ SpeakerNamesZSpeakerSeparationTypeZStepFunctionNameZSupportFilesBucketNameZTranscribeLanguagesZTelephonyCTRTypeZTelephonyCTRFileSuffixZVocabularyNameZCustomLangModelNameZFilenameDatetimeRegexZFilenameDatetimeFieldMapZFilenameGUIDRegexZFilenameAgentRegexZFilenameCustRegexZVocabFilterModeZVocabFilterNameZ KendraIndexIdZWebUriZTranscribeApiModeZCallRedactionTranscriptZCallRedactionAudioZBulkUploadBucketZBulkUploadMaxTranscribeJobsZBulkUploadMaxDripRatestandard analyticszanalytics-streamingspeakerZchannelauto>tagmaskremovecCsN|dD]}|d}|d}|t|<q|dD] }|r |t|<qdt|<qdS)zo Picks out the Parameter Store results and appends the values to our overall 'appConfig' variable. Z ParametersNameValueZInvalidParametersN) appConfig)Z ssmResponseZ useTagNameparamnamevalueZ paramNamerj/Users/cmlott/Code/transcribe/amazon-transcribe-post-call-analytics/pca-server/src/pca/pcaconfiguration.pyextractParametersNs     rc Cstd}|jttttttt t t t g d}|jt tttttttttg d}|jtttttttttt g d}|jt!t"t#t$t%t&t't(t)g d}t*|dt*|dt*|dt*|dt+tdkrbdt+t<t+tdkrldt+t<t+tdkrvdt+t<t+tt,vrdt+t<dt+t<t+t-t+t<t+tt.vrt/t+t<t0t+tt+t<t0t+tt+t<t0t+tt+t<t+t1dt+t<t+t1dt+t<t+t1dt+t<t+t1dt+t<t+t1dt+t<t+t)1dt+t)<dS)z Loads in the configuration values from Parameter Store. Bulk loads them in batches of 10, and any that are missing are set to an empty string or to the tag-name. ssm)ZNamesFr g?z | N)2boto3clientZget_parametersCONF_COMP_LANGSCONF_REDACTION_LANGSCONF_ENTITYENDPOINTCONF_ENTITY_FILECONF_ENTITYCONFCONF_PREFIX_AUDIO_PLAYBACKCONF_S3BUCKET_INPUTCONF_PREFIX_RAW_AUDIOCONF_PREFIX_FAILED_AUDIOCONF_PREFIX_INPUT_TRANSCRIPTSCONF_MAX_SPEAKERSCONF_MINNEGATIVECONF_MINPOSITIVECONF_S3BUCKET_OUTPUTCONF_PREFIX_PARSED_RESULTSCONF_SPEAKER_NAMESCONF_SPEAKER_MODE COMP_SFN_NAMECONF_SUPPORT_BUCKETCONF_TRANSCRIBE_LANGCONF_PREFIX_TRANSCRIBE_RESULTSCONF_VOCABNAME CONF_CLMNAMECONF_CONVO_LOCATIONCONF_ENTITY_TYPESCONF_FILTER_MODECONF_FILTER_NAMECONF_FILENAME_DATETIME_REGEXCONF_FILENAME_DATETIME_FIELDMAPCONF_FILENAME_GUID_REGEXCONF_FILENAME_AGENT_REGEXCONF_FILENAME_CUST_REGEXCONF_KENDRA_INDEX_ID CONF_WEB_URICONF_TRANSCRIBE_APICONF_REDACTION_TRANSCRIPTCONF_REDACTION_AUDIOCONF_TELEPHONY_CTRCONF_TELEPHONY_CTR_SUFFIXrr VOCAB_FILTER_MODESlower SPEAKER_MODESSPEAKER_MODE_SPEAKERfloatsplit)rZfullParamList1ZfullParamList2ZfullParamList3ZfullParamList4rrrloadConfigurationbs          rDcCstttdkS)z Returns flag to indicate if we need to do Auto Language Detection in Transcribe, which is indicated by multiple languages being defined on the config parameter N)lenr r*rrrrisAutoLanguageDetectionSetsrGcCs ttdkS)zL Returns flag to indicate if we need to enable Transcribe redaxtion trueN)r r:rrrrisTranscriptRedactionEnableds rIcCstottdkS)a Returns flag to indicate if we need to only allow the playback of redacted audio. This is only valid on Call Analytics jobs, as other Transcribe modes don't generate redacted audio, and it is only generated if transcription was enabled in the first place rHN)rIr r;rrrrisAudioRedactionEnabledsrJ__main__)<__doc__rrrr.rrrr/rrrrr r!r"r#r$r+r%r&r'r(r)r*r<r=r,r-r2r3r4r5r6r0r1r7r8r9r:r;ZBULK_S3_BUCKETZBULK_JOB_LIMITZBULK_MAX_DRIP_RATEZ API_STANDARDZ API_ANALYTICSZAPI_STREAM_ANALYTICSrAZSPEAKER_MODE_CHANNELZSPEAKER_MODE_AUTOr@r>ZNLP_THROTTLE_RETRIESr rrDrGrIrJ__name__rrrrs| b