eval_agent2 / validation_agent /schemas /data_inventory.schema.json
rongrong620's picture
Add files using upload-large-folder tool
ecf96d4 verified
Raw
History Blame Contribute Delete
6.73 kB
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "data_inventory.schema.v0.1",
"title": "DataInventory",
"description": "Deterministic, aggregate-only data inventory (11 §3). Produced by core/data_inventory.py in mode=v7|hpp. Contains NO individual-level data. It is the sole authority for what each edge can be validated against — not LLM imagination.",
"type": "object",
"additionalProperties": false,
"required": ["env", "mode", "generated_at", "metadata_version", "data_root", "privacy", "datasets", "overlap_matrix", "subgroup_availability"],
"properties": {
"env": {"type": "string", "enum": ["v7", "hpp"], "description": "v7 = synthetic dev (LLM allowed); hpp = real intranet (no LLM, air-gapped)."},
"mode": {"type": "string", "enum": ["v7", "hpp"]},
"generated_at": {"type": "string"},
"metadata_version": {"type": "string"},
"data_root": {"type": "string", "description": "v7_root or hpp_root (path; never echoed into any LLM in hpp mode)."},
"probe_version": {"type": "string"},
"privacy": {
"type": "object",
"additionalProperties": false,
"required": ["min_cell_count", "small_cell_policy"],
"description": "HPP aggregate-only export policy (11 §0/§3). The inventory contains NO individual-level data; any aggregate count strictly below min_cell_count is suppressed.",
"properties": {
"min_cell_count": {"type": "integer", "minimum": 0, "description": "small-cell suppression threshold (e.g. 0 for v7 dev; >=5 for HPP)"},
"small_cell_policy": {"type": "string", "enum": ["suppress", "none"], "description": "'suppress' (HPP): counts < min_cell_count exported as null + suppressed flag; 'none' (v7 dev)"},
"suppression_applied": {"type": ["boolean", "null"], "description": "true if any count was suppressed in this inventory"},
"export_whitelist": {"type": ["array", "null"], "items": {"type": "string"}, "description": "the ONLY top-level keys allowed to leave HPP; anything else is never exported"}
}
},
"datasets": {
"type": "array",
"items": {"$ref": "#/$defs/dataset_inventory"}
},
"overlap_matrix": {
"type": "object",
"additionalProperties": false,
"required": ["entries"],
"description": "X/Y/Z pairwise participant_id overlap — the simplified embedded form (raw integer counts only). The richer standalone form (role-tagged members + sufficient + nullable small-cell suppression) is schemas/overlap_matrix.schema.json; under small_cell_policy='none' (v7) the counts here equal the standalone overlap/a_only/b_only. HPP suppression (M1b/M2) will make these entries nullable.",
"properties": {
"entries": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["a", "b", "overlap", "a_only", "b_only"],
"properties": {
"a": {"type": "string"},
"b": {"type": "string"},
"overlap": {"type": "integer", "minimum": 0},
"a_only": {"type": "integer", "minimum": 0},
"b_only": {"type": "integer", "minimum": 0}
}
}
}
}
},
"subgroup_availability": {
"type": "object",
"description": "Per 08 catalog dim id (D01..D09): availability + strata sizes computed deterministically from the inventory.",
"additionalProperties": {
"type": "object",
"additionalProperties": false,
"required": ["available"],
"properties": {
"available": {"type": "boolean"},
"n_per_stratum": {"type": "object", "additionalProperties": {"type": "integer"}},
"reason_unavailable": {"type": ["string", "null"]}
}
}
},
"subgroup_candidates": {
"type": "array",
"description": "Data-driven effect-modifier candidates discovered generically from cohort-overlapping flat tables (cardinality + stratum-size only; no D01-D09 whitelist). Supersedes subgroup_availability as the planner's subgroup signal.",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["dataset", "field", "kind", "n_per_stratum"],
"properties": {
"dataset": {"type": "string"},
"field": {"type": "string"},
"kind": {"type": "string", "enum": ["categorical", "binned_tertile"]},
"n_per_stratum": {"type": "object", "additionalProperties": {"type": "integer"}}
}
}
}
},
"$defs": {
"dataset_inventory": {
"type": "object",
"additionalProperties": false,
"required": ["dataset", "exists", "excluded", "fields"],
"properties": {
"dataset": {"type": "string", "description": "bare dataset name (no numeric prefix)"},
"sub_table": {"type": ["string", "null"]},
"exists": {"type": "boolean"},
"excluded": {"type": "boolean", "description": "true if in configs/excluded_datasets.json (medications / diet-self-report)"},
"excluded_reason": {"type": ["string", "null"]},
"n_rows": {"type": ["integer", "null"], "minimum": 0},
"participant_id_coverage": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"n_unique": {"type": "integer", "minimum": 0},
"covers_full_cohort": {"type": ["boolean", "null"]}
}
},
"cohort_coverage": {"type": ["array", "null"], "items": {"type": "string"}},
"timepoints": {"type": ["array", "null"], "items": {"type": "string"}, "description": "visits / research_stages present"},
"batch_platform_assay": {"type": ["object", "null"], "additionalProperties": true, "description": "batch / platform / assay info if the env provides it; null otherwise"},
"fields": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["name", "dtype", "n_total", "n_non_null"],
"properties": {
"name": {"type": "string"},
"dtype": {"type": "string"},
"unit": {"type": ["string", "null"]},
"coding_dict": {"type": ["object", "null"], "additionalProperties": true, "description": "categorical code→label map if known; aggregate only"},
"n_total": {"type": "integer", "minimum": 0},
"n_non_null": {"type": "integer", "minimum": 0},
"missing_rate": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
"is_container": {"type": "boolean"}
}
}
}
}
}
}
}