def run_analyze_document()

in deploy_code/multipagepdfa2i_analyzepdf/lambda_function.py [0:0]


def run_analyze_document(event):
    client = boto3.client('textract')
    
    response = client.analyze_document(
        Document={
            'S3Object': {
                'Bucket': event["bucket"],
                'Name': event["process_key"]
            }
        },
        FeatureTypes=['FORMS'],
        HumanLoopConfig={
            'HumanLoopName': event["human_loop_id"],
            'FlowDefinitionArn': os.environ['human_workflow_arn'],
            'DataAttributes': {
                'ContentClassifiers': [
                    'FreeOfPersonallyIdentifiableInformation',
                    'FreeOfAdultContent'
                ]
            }
        }
    )
    need_to_human_review = False
    if len(response["HumanLoopActivationOutput"]["HumanLoopActivationReasons"]) != 0:
        need_to_human_review = True
    return response, need_to_human_review