Edit on GitHub

parascape.spaces

Shared validation for building one organism's data space without silent data loss.

Different organisms use different identifiers and evidence coverage, even when their tables share a schema. The common validation layer checks the declared space before downstream consumers use it, so an apparently successful import cannot quietly substitute another species or conceal dropped measurements.

def validate_nodes( space, nodes: pandas.DataFrame, previous: pandas.DataFrame | None = None) -> None:

Require canonical unique IDs; refuse lost old IDs, columns or measured cells.

def validate_graph(nodes: pandas.DataFrame, graph_path) -> None:

Require finite display coordinates, exact gene order and in-range edge indices.

def build_pack( space, directory, version: str, column_licenses: dict, destination, previous=None, extra: dict | None = None) -> str:

Validate a prepared space and create its distributable pack; return the archive SHA256.

Callers supply the per-column license decisions. Unreviewed (V) and local-only (X) sources cannot enter a distributed pack. Raw-source acquisition remains the organism builder's job. extra maps further pack member names (attribution notices, column descriptions, link tables) to files; they are hash-checked like the tables but never replace the node table or graph.