phenotypic.sdk_.record_provenance#

phenotypic.sdk_.record_provenance(record: object) str[source]#

Return a record’s provenance, defaulting to "forward" (U-10).

Absent means forward, and that is the strict reading. A record written before this field existed – or by any writer that forgets it – must be fenced on work_id like any other, so the default is the value that keeps the fence. Defaulting to "migrated", or reading a bare record["provenance"] and treating the KeyError as “unmarked”, would strip the fence from every tree written before P3.

A function rather than the record.get("provenance", "forward") the plan prescribes: the rule is a default, and a default restated at each call site is one edit away from being two defaults. This is the same reason stage3_markers_required is a live gate finding.

Parameters:

record (object) – A record mapping, or anything at all – a non-mapping is treated as unmarked rather than raising, so a caller that already has read_image_record()’s None need not branch twice.

Returns:

PROVENANCE_MIGRATED only when the record says so explicitly; PROVENANCE_FORWARD in every other case.

Return type:

str