maxwellinked's picture
Define authoritative recording modes in all recording indexes (#107)
0a323dd
|
Raw History Blame Contribute Delete
4.55 kB
# Standard workflow selections
The two CSVs in this folder are generated access views of the authoritative
root [Standard index](../metadata.csv). Membership uses only the existing
`acquisition_protocol_version` values:
- `standard_earlier`: `standard-2025-07-13`.
- `standard_individual_recordings`: `standard-2026-08-27`.
Each CSV preserves the source header, row order, and every field value.
This includes the authoritative `recording_mode = time_lapse` field. The mode
does not replace the acquisition protocol used to select these two workflows.
Its `file_name` paths are relative to the **repository root**, not this folder.
The native configurations load the corresponding Parquet tables under `viewer/`.
The generator applies the same protocol partition to the root index and stores
only pinned references to the selected videos. They retain the existing typed
video feature and `archive` split. Unknown starts and unresolved work IDs remain
included. The two views partition `canonical`; do not add their counts to it.
## Maintain the generated views
Regenerate after the normal identity/timing projections and canonical count
update, following the [existing ingest procedure](../Standard_Time_Lapses/Provenance/Recording_Timing_Current/README.md#repeat-with-a-later-ingest):
```sh
python tools/project_recording_modes.py --root .
python tools/build_workflow_subsets.py --root . --source-revision FULL_COMMIT_SHA --write
python tools/build_workflow_subsets.py --root . --check-loading
python -m unittest discover -s tools -p 'test_*.py'
```
The repository pins `datasets==4.8.5` for loading; generation also needs
PyYAML and PyArrow. Counts, CSV views, native Parquet tables, and configuration
paths are generated and checked together; do not edit generated outputs manually.
Use the immutable revision that already contains the corresponding source CSVs
and media paths. The loading check refuses video payload reads, checks the native
table inputs and pinned media references, and compares every loaded field to the
source. See the [native Viewer build contract](../viewer/NATIVE_VIEWER.md). This does not establish
hosted Viewer cache readiness. Regeneration is part of the manual maintainer
procedure; it is not a scheduled or automated ingestion service.
## Retain a selection before downloading videos
Resolve the desired revision once and save its full commit and chosen IDs.
This example downloads only the generated CSV; media downloads remain separate.
Use a revision containing the configurations, since earlier immutable releases
retain their original layout.
```python
import csv
import hashlib
import json
from pathlib import Path
from huggingface_hub import HfApi, hf_hub_download
repo = 'maxwellinked/time-lapse-artifacts'
config = 'standard_earlier' # or 'standard_individual_recordings'
revision = HfApi().dataset_info(repo, revision='main').sha
index_name = f'Workflow_Subsets/{config}.csv'
index = Path(hf_hub_download(repo, index_name, repo_type='dataset', revision=revision))
with index.open(encoding='utf-8', newline='') as handle:
rows = list(csv.DictReader(handle))
# Optionally filter timing evidence, dates, materials, or confirmed work IDs
# here. Retain the filter description and the exact resulting IDs.
selection = {
'repo_id': repo,
'revision': revision,
'config': config,
'split': 'archive',
'index_path': index_name,
'index_sha256': hashlib.sha256(index.read_bytes()).hexdigest(),
'filters': [],
'record_ids': [row['record_id'] for row in rows],
}
Path('selection.json').write_text(json.dumps(selection, indent=2) + '\n', encoding='utf-8')
```
Load the same unfiltered workflow through the native library at that revision:
```python
from datasets import Video, load_dataset
records = load_dataset(repo, config, split='archive', revision=revision, streaming=True)
records = records.cast_column('video', Video(decode=False))
assert {row['record_id'] for row in records} == {row['record_id'] for row in rows}
```
If optional filters were applied to `rows`, apply the same filters to the
loaded records before this comparison. For an intentional media download, use
a retained record ID and commit with the existing verified downloader:
```sh
python tools/download_verified.py RECORD_ID --revision FULL_COMMIT_SHA --check-only
# Replace --check-only with --output-dir DESTINATION for the selected download.
```
The saved selection records a research population. It does not create new
archive classifications, work identities, or timing observations.