Skip to content

finprint.schema

module finprint

The recipe file, <output>.recipe.json (schema ump.transform_recipe/0.1).

The normative model is ump_spec.models.TransformRecipe (packages/ump-spec/schemas/transform-recipe.json). This package keeps an identical copy because analysts install it without ump_spec; the JSON Schema in schema/transform_recipe.schema.json is generated from these models (finprint schema), one test fails when it drifts from these models and another (tests/test_spec_alignment.py, run when ump_spec is importable) fails when it differs from ump_spec’s.

What a recipe never holds: row values, cell outputs, environment variables, absolute paths (basenames only), values of arguments whose name looks secret ("<redacted>") and string arguments longer than 200 characters (kept as a short prefix plus their hash).

class

class RecipeNote(_Model)

Fields

NameTypeDefaultDescription
codeNoteCodeName
severityLiteral['info', 'warn']
messagestr
cellslist[int]list()Notebook execution counts the note is about.
step_idstr | NoneNone

Source: packages/finprint/src/finprint/schema.py, line 40

class

class ReaderSpec(_Model)

Fields

NameTypeDefaultDescription
fnLiteral['read_csv', 'read_excel', 'read_parquet', 'read_catalogue']
kwargsdict[str, Any]dict()Reader keyword arguments, tagged JSON (no path).
replayableboolTrue

Source: packages/finprint/src/finprint/schema.py, line 48

class

class RecipeInput(_Model)

Fields

NameTypeDefaultDescription
input_idstrAlso the frame id steps use to refer to this input.
namestr
sourceLiteral['file', 'catalogue', 'in_memory']
path_basenamestr | NoneNone
sha256str | NoneNonesha256 hex of the file bytes (stored catalogue datasets: blob hash).
fingerprintstrCanonical-rows fingerprint of the frame as read (see fingerprint_basis).
fingerprint_basisstrFINGERPRINT_BASIS
dataset_idstr | NoneNone
catalogue_fingerprintstr | NoneNoneThe catalogue’s rule (ump_spec.rules.canonical_rows_fingerprint, basis canonical_rows) over the frame as read, cells as plain JSON values; column and row order free. apps/data matches inputs to connected datasets by it.
fingerprint_seenstr | NoneNonefetch_record.fingerprint_seen from apps/data when read from the catalogue (blob hash for stored datasets, canonical rows of the raw rows for connected ones).
copy_policyCopyPolicy | NoneNone
readerReaderSpec | NoneNone
rowsint
columnsdict[str, str]Column name to pandas dtype.

Source: packages/finprint/src/finprint/schema.py, line 54

class

class RecipeStep(_Model)

Fields

NameTypeDefaultDescription
step_idstr
kindLiteral['named', 'verb', 'cell_edit']
opstrMethod name, ‘loc.setitem’, ‘groupby.sum’, ‘call:pandas.concat’, a named step’s function name, or ‘unrecorded_change’.
argsdict[str, Any]dict()Tagged JSON: frames as {‘frame’: id}, series expressions as {‘expr’: …}.
codestr | NoneNone
code_sha256str | NoneNone
inputslist[str]list()Frame ids read by this step; the first is ‘self’.
outputstr
output_kindLiteral['frame', 'series']'frame'
rows_beforeint | NoneNone
rows_afterint
columns_addedlist[str]list()
columns_removedlist[str]list()
dtype_changesdict[str, str]dict()
fingerprintstrIn-memory hash of this step’s output (basis memory_hash/ump_recipe-1: values, column and index names, shape); replay compares it with the replayed object.
replayableboolTrue
cellint | NoneNoneNotebook execution count when the step ran.
notestr | NoneNone

Source: packages/finprint/src/finprint/schema.py, line 76

class

class RecipeCell(_Model)

Fields

NameTypeDefaultDescription
execution_countint | NoneNone
orderint
sourcestr
frames_changedlist[str]list()

Source: packages/finprint/src/finprint/schema.py, line 100

class

class RecipeOutput(_Model)

Fields

NameTypeDefaultDescription
path_basenamestr | NoneNone
frame_idstr
formatLiteral['csv', 'parquet']'csv'
sha256str | NoneNonesha256 hex of the file as written; null when rows were not written.
fingerprintstrCanonical-rows fingerprint of the file as written and read back.
fingerprint_basisstrFINGERPRINT_BASIS
rowsint
columnsdict[str, str]
rows_writtenboolTrue
index_writtenboolFalse

Source: packages/finprint/src/finprint/schema.py, line 107

class

class RecipeEnvironment(_Model)

Fields

NameTypeDefaultDescription
pythonstr
pandasstr
numpystr
ump_recipestr
platformstr

Source: packages/finprint/src/finprint/schema.py, line 120

class

class RecipeVerification(_Model)

Fields

NameTypeDefaultDescription
statusVerificationStatus'not_checked'
first_divergent_stepstr | NoneNone
checked_atdatetime | NoneNone
checked_byLiteral['self'] | NoneNone
messagestr | NoneNone

Source: packages/finprint/src/finprint/schema.py, line 128

class

class TransformRecipe(_Model)

<output>.recipe.json: inputs by hash, steps, notebook cells, the output’s fingerprint and the analyst’s own replay check.

Fields

NameTypeDefaultDescription
schema_versionLiteral['ump.transform_recipe/0.1']'ump.transform_recipe/0.1'
recipe_idstr
titlestr
created_atdatetime
authorstr | NoneNone
inputslist[RecipeInput]
stepslist[RecipeStep]
cellslist[RecipeCell]list()
cells_includedboolTrue
outputRecipeOutput
captureLiteral['full', 'partial']'full'
noteslist[RecipeNote]list()
environmentRecipeEnvironment
verificationRecipeVerificationRecipeVerification()
Methods and properties (1)

to_json method

def to_json(self) -> str

Source: packages/finprint/src/finprint/schema.py, line 136

function

def json_schema() -> dict[str, Any]

JSON Schema 2020-12 for TransformRecipe (the form the published file holds).

Source: packages/finprint/src/finprint/schema.py, line 165

function

def json_schema_text() -> str

Source: packages/finprint/src/finprint/schema.py, line 171

function

def load_recipe(path: str | Path) -> TransformRecipe

Source: packages/finprint/src/finprint/schema.py, line 175

function

def write_recipe(recipe: TransformRecipe, path: str | Path) -> None

Source: packages/finprint/src/finprint/schema.py, line 179

NameTypeValueDescription
SCHEMA_VERSION'ump.transform_recipe/0.1'
SCHEMA_ID'https://schemas.ump.dev/v1/transform-recipe.json'Same $id as ump_spec’s exported schema, so the two files are equal.
FINGERPRINT_BASIS'canonical_rows/ump_recipe-2'
CATALOGUE_FINGERPRINT_BASIS'canonical_rows'
STEP_HASH_BASIS'memory_hash/ump_recipe-1'
VerificationStatusLiteral['not_checked', 'reproduced', 'not_reproduced', 'not_replayable', 'inp...
CopyPolicyLiteral['allowed', 'transient_only', 'aggregates_only']
NoteRecipeNote
EnvironmentRecipeEnvironment
VerificationRecipeVerification