Skip to content

Commit

Permalink
Merge pull request #661 from Health-Informatics-UoN/fix/null-data-dic…
Browse files Browse the repository at this point in the history
…tionary

Fix Scan Report upload without data dictionary
  • Loading branch information
AndyRae authored Apr 1, 2024
2 parents 91452ce + 45dd365 commit 9f9d34e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/workers/shared_code/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class ScanReportStatus(Enum):
UPLOAD_IN_PROGRESS = "UPINPRO"
UPLOAD_COMPLETE = "UPCOMPL"
UPLOAD_FAILED = "UPFAIL"
UPLOAD_FAILED = "UPFAILE"
PENDING = "PENDING"
COMPLETE = "COMPLET"

Expand Down
8 changes: 5 additions & 3 deletions app/workers/shared_code/blob_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
import os
from io import BytesIO
from typing import Any, Dict, List, Tuple
from typing import Any, Dict, List, Optional, Tuple

import openpyxl
from azure.storage.blob import BlobServiceClient
Expand Down Expand Up @@ -123,16 +123,18 @@ def get_scan_report(blob: str) -> openpyxl.Workbook:

def get_data_dictionary(
blob: str,
) -> Tuple[Dict[str, Dict[str, Any]], Dict[str, Dict[str, Any]]]:
) -> Tuple[Optional[Dict[str, Dict[str, Any]]], Optional[Dict[str, Dict[str, Any]]]]:
"""
Retrieves the data dictionary and vocabulary dictionary from a blob storage.
Args:
blob (str): The name of the blob containing the data dictionary.
Returns:
Tuple[Dict[Any, Any], Dict[Any, Any]]: A tuple containing the data dictionary and vocabulary dictionary.
Tuple[Optional[Dict[str, Dict[str, Any]]], Optional[Dict[str, Dict[str, Any]]]]: A tuple containing the data dictionary and vocabulary dictionary.
"""
if blob == "None":
return None, None

# Set Storage Account connection string
blob_service_client = BlobServiceClient.from_connection_string(
Expand Down

0 comments on commit 9f9d34e

Please sign in to comment.