in src/annotation_consolidation_lambda.py [0:0]
def get_annotations(annotation_map, s3_client, file_name):
"""Return a transformed annotations to be written."""
blocks_entities_map = json.loads(annotation_map)
page = blocks_entities_map.get("DocumentMetadata", {}).get("Page", "unknown")
annotation_file_name = get_annotation_file_name(file_name, page)
return {
"Version": blocks_entities_map.get("Version", "unknown"),
"DocumentType": blocks_entities_map.get("DocumentType", "unknown"),
"DocumentMetadata": get_doc_metadata(blocks_entities_map.get("DocumentMetadata", {})),
"Blocks": get_blocks_from_s3_ref(blocks_entities_map.get('BlocksS3Ref', ''), s3_client),
"Entities": blocks_entities_map.get('Entities', []),
"File": annotation_file_name
}