source_patch_id

function of dascore.utils.identity source

source_patch_id(
    format_name: str ,
    version: str ,
    path: str ,
    key: <class ‘object = None,
    size_bytes: int | None[int, None] = None,
    mtime_ns: int | None[int, None] = None,
)-> ’str’

Return the id of data read from a file.

The deterministic ID lets repeated reads of the same source agree and preserves provenance across processes.

Parameters

Parameter Description
format_name The format the reader was using.
version The version of that format the file was read at.
path The path or URI the data came from, as the archive spells it.
key What names this patch within the file, when a file holds more than
one. The reader’s own key if it has one, else the ordinal.
size_bytes The size of the source, when it can be had.
mtime_ns When the source was last written, when it can be had.
Note

Every field already exists in the index, so no filesystem access is required. Size and modification time distinguish replaced sources; unavailable values may be None. Changing modification time changes the ID even if contents are unchanged. Path-derived IDs depend on archive layout and are not stable across hosts. IDs stored by a format remain authoritative and portable.