from dascore.utils.identity import advance, fold_patch_ids
# What was done: the operation folds into what came before.
first = advance("", "0123456789abcdef")
assert advance(first, "0123456789abcdef") != first
# Which data: combining two sources makes a new answer.
assert fold_patch_ids(["a", "b"]) != fold_patch_ids(["b", "a"])identity
Create and advance patch identity values.
patch_id identifies source data. It survives operations that preserve what the data describe and changes when multiple sources are combined. processing_id identifies the processing path and advances by folding each operation’s fingerprint into its input ID.
Both IDs are deterministic after source identity is established. Patches built directly in memory receive process-local random IDs; readers may derive stable IDs from source metadata or use IDs stored by the format.
Examples
Functions
| Name | Description |
|---|---|
| advance | Return the processing id an operation leads to. |
| fold_ids | Return the ids a patch combined from several inherits. |
| fold_patch_ids | Return the patch id of a patch combined from several. |
| fold_processing_ids | Return the processing id which several inputs agree on. |
| ids_enabled | Whether this process is keeping track of what a patch is. |
| new_patch_id | Return an id for data which names no source. |
| operation_fingerprint | Return the digest which identifies an operation and its parameters. |
| patch_id_of | Return which data some attrs say they are, or nothing if they cannot. |
| processing_id_of | Return what some attrs say was done, or nothing if they cannot. |
| source_patch_id | Return the id of data read from a file. |
| stamp_combination | Return the ids a patch made from several members carries. |
| with_patch_id | Return attrs which name which data they belong to. |