Skip to content

Commit

Permalink
fix: output null in index when no dataset download
Browse files Browse the repository at this point in the history
* output null instead of empty string when there is no cached download available for the dataset
* rename function that provides list of fields to better describe its purpose
  • Loading branch information
simon-20 committed Oct 25, 2024
1 parent 6225e61 commit bec41bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/bulk_data_service/dataset_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def get_index_entry(context: dict, dataset: dict, index_type: str) -> dict[str,
else:
dataset_index_entry = get_full_index_entry_from_dataset(context, dataset)

dataset_index_entry["url_xml"] = ""
dataset_index_entry["url_zip"] = ""
dataset_index_entry["url_xml"] = None
dataset_index_entry["url_zip"] = None

if dataset_index_entry["last_successful_download"] is not None:
dataset_index_entry["url_xml"] = get_azure_blob_public_url(context, dataset, "xml")
Expand All @@ -80,7 +80,7 @@ def get_minimal_index_entry_from_dataset(context: dict, dataset: dict) -> dict:


def get_full_index_entry_from_dataset(context: dict, dataset: dict) -> dict:
full_index_entry = {k: v for k, v in dataset.items() if k in get_full_index_fields(context)}
full_index_entry = {k: v for k, v in dataset.items() if k in get_full_index_source_fields(context)}

field_from_json_str_to_object(full_index_entry, "download_error_message", "download_error_details")

Expand All @@ -96,7 +96,7 @@ def field_from_json_str_to_object(entry: dict, source_field: str, dest_field: st
del entry[source_field]


def get_full_index_fields(context: dict) -> list[str]:
def get_full_index_source_fields(context: dict) -> list[str]:
return [
"id",
"name",
Expand Down

0 comments on commit bec41bf

Please sign in to comment.