Skip to content

Commit

Permalink
fix: Guard against data without OCIDs. No data will be stored, and so…
Browse files Browse the repository at this point in the history
… later steps will be no-op.
  • Loading branch information
jpmckinney committed Sep 22, 2022
1 parent 1fe2fb8 commit 3c8f57a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions process/management/commands/file_worker.py
Expand Up @@ -217,6 +217,11 @@ def _store_data(collection_file, package, releases_or_records, data_type, upgrad

data = _store_deduplicated_data(Data, release_or_record)

# The ocid is required to find all the releases relating to the same record, during compilation.
if "ocid" not in release_or_record:
logger.error("Skipped release or record without ocid: %s", release_or_record)
continue

if data_type["format"] == RECORD_PACKAGE:
Record(
collection=collection_file.collection,
Expand Down
2 changes: 1 addition & 1 deletion process/management/commands/release_compiler.py
Expand Up @@ -69,7 +69,7 @@ def compile_release(compiled_collection_id, ocid):
if isinstance(package_extensions, list):
extensions.update(package_extensions)
else:
logger.error("Skipped malformed extensions for release %s: %s", release, package_extensions)
logger.error("Ignored malformed extensions for release %s: %s", release, package_extensions)

# estonia_digiwhist publishes release packages containing a single release with a "compiled" tag, and it sometimes
# publishes the same OCID with identical data in different packages with a different `publishedDate`. The releases
Expand Down

0 comments on commit 3c8f57a

Please sign in to comment.