diff --git a/src/isar/storage/slimm_storage.py b/src/isar/storage/slimm_storage.py index 9a717290..52b247ce 100644 --- a/src/isar/storage/slimm_storage.py +++ b/src/isar/storage/slimm_storage.py @@ -7,12 +7,12 @@ from requests_toolbelt import MultipartEncoder from isar.config.settings import settings -from robot_interface.models.mission.mission import Mission from isar.services.auth.azure_credentials import AzureCredentials from isar.services.service_connections.request_handler import RequestHandler from isar.storage.storage_interface import StorageException, StorageInterface from isar.storage.utilities import get_filename from robot_interface.models.inspection.inspection import Inspection, ThermalVideo, Video +from robot_interface.models.mission.mission import Mission class SlimmStorage(StorageInterface): @@ -125,7 +125,8 @@ def _construct_multiform_request_image( "ImageMetadata.AnalysisMethods": inspection.metadata.additional[ "analysis_type" ] - if inspection.metadata.additional["analysis_type"] + if inspection.metadata.additional + and inspection.metadata.additional["analysis_type"] else "N/A", "ImageMetadata.Description": str(inspection.metadata.additional), "ImageMetadata.FunctionalLocation": inspection.metadata.tag_id # noqa: E501 @@ -172,7 +173,8 @@ def _construct_multiform_request_video( "VideoMetadata.AnalysisMethods": inspection.metadata.additional[ "analysis_type" ] - if inspection.metadata.additional["analysis_type"] + if inspection.metadata.additional + and inspection.metadata.additional["analysis_type"] else "N/A", "VideoMetadata.Description": str(inspection.metadata.additional), "VideoMetadata.FunctionalLocation": inspection.metadata.tag_id # noqa: E501 diff --git a/src/isar/storage/utilities.py b/src/isar/storage/utilities.py index 32e2d535..5a79cb20 100644 --- a/src/isar/storage/utilities.py +++ b/src/isar/storage/utilities.py @@ -40,7 +40,9 @@ def construct_metadata_file( "mission_date": datetime.utcnow().date(), "isar_id": settings.ISAR_ID, "robot_name": settings.ROBOT_NAME, - "analysis_type": inspection.metadata.additional["analysis_type"], + "analysis_type": inspection.metadata.additional["analysis_type"] + if inspection.metadata.additional + else "N/A", }, "data": [ {