name: Validate Dataset Integrity on: [push, pull_request] jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install dependencies run: pip install numpy scipy pytest - name: Download dataset from release run: | RELEASE_URL="https://github.com/ScandiumLabs-in/Scandium-Dataset/releases/download/v0.0.0" mkdir -p dataset for f in entries_final_v3 battery_candidate_subset_v1 solid_electrolyte_candidate_subset_v1; do echo "Downloading ${f}.json..." curl -sL "$RELEASE_URL/${f}.json" -o "dataset/${f}.json" done echo "Downloads complete." - name: Verify manifest checksums run: | cat > /tmp/check_manifest.py << 'PYEOF' import json, hashlib with open('dataset/manifests/MANIFEST_v3.json') as f: manifest = json.load(f) for name, info in manifest.items(): if not isinstance(info, dict) or 'sha256' not in info: continue path = 'dataset/' + name actual = hashlib.sha256(open(path, 'rb').read()).hexdigest() match = 'OK' if actual == info['sha256'] else 'MISMATCH' print(f' {match}: {name} ({actual[:12]}...)') assert actual == info['sha256'], name + ': checksum mismatch' print('All checksums verified.') PYEOF python /tmp/check_manifest.py - name: Verify splits run: | cat > /tmp/check_splits.py << 'PYEOF' import json with open('dataset/entries_final_v3.json') as f: entries = json.load(f) print('Dataset:', len(entries), 'entries') for sn in ['random_80_10_10','composition_held_out','family_held_out','chemistry_held_out']: with open('dataset/splits/' + sn + '.json') as f: sp = json.load(f) n = len(sp['train']) + len(sp['val']) + len(sp['test']) print(' ' + sn + ': ' + str(n) + ' indices (' + str(len(sp['train'])) + ' train)') PYEOF python /tmp/check_splits.py - name: Run integrity tests run: python -m pytest tests/test_dataset_integrity.py -v