Skip to content

Chemistry backfill should handle missing Observation during note creation #565

@kbighorse

Description

@kbighorse

Context

Identified during review of #558 (558-radionuclides-backfill branch).

Problem

In chemistry_backfill.py, after the pg_insert upsert, the code looks up the just-upserted Observation using scalar_one() (line ~259). This can raise NoResultFound or MultipleResultsFound with no context about which GlobalID was being processed.

Fix

Replace scalar_one() with scalar_one_or_none() and add explicit error handling that includes the GlobalID in the error message. Append to result.errors and continue rather than crashing the entire backfill.

Files

  • transfers/backfill/chemistry_backfill.py (lines 255–259)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions