File size: 1,368 Bytes
c9ed891
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Check payload inventory, referenced media, and trial identity alignment."""
import json
from pathlib import Path

import pyarrow.parquet as pq

root = Path(__file__).resolve().parent
entries = [json.loads(line) for line in (root / "manifest.jsonl").read_text().splitlines()]
for entry in entries:
    path = root / entry["path"]
    assert path.is_file(), f"Missing file: {path}"
    assert path.stat().st_size == entry["bytes"], f"Size mismatch: {path}"

media = pq.read_table(root / "cluster/media.parquet").to_pylist()
trials = pq.read_table(root / "cluster/trials.parquet").to_pylist()
assert len(media) == len(trials) == 18880
assert len({r["trial_id"] for r in media}) == len(media)
assert {(r["trial_id"], r["stem"]) for r in media} == {
    (r["trial_id"], r["stem"]) for r in trials
}
for row in media:
    for key in ("path_video",):
        assert (root / "cluster" / row[key]).is_file(), (row["trial_id"], key)
for excluded in ("cluster/audio", "cluster/haptic", "cluster/image", "havdb/datah5", "havdb/img"):
    assert not (root / excluded).exists(), f"Upstream payload should be excluded: {excluded}"
meta = json.loads((root / "havdb/cache/meta.json").read_text())
assert all(len(meta[key]) == 500 for key in ("user", "texture", "trial", "length"))
print(f"Validated {len(entries)} payload files, 18,880 Cluster trials, 500 HAVdb feature entries.")