Skip to content

Commit

Permalink
Fix analysis type key error bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Christdej committed Oct 4, 2023
1 parent ef6d1bf commit 9479deb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/isar/storage/slimm_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/isar/storage/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

0 comments on commit 9479deb

Please sign in to comment.