# CLAUDE.md Context for continuing work on this dataset. Captures the design decisions and conventions worked out so far. ## What this dataset is `Inova-Mk1-Database` is the **canonical graph dataset** of Inova Mk1 SLS printer entities — jobs, print sessions, print profiles, and STL objects. Each entity is its own HuggingFace config; relationships are encoded as **ID references in FK-style fields**, not via an explicit `edges.parquet`. Domain-specific datasets (`Inova-Mk1-ASTM`, future `Inova-Mk1-Telemetry`) reference rows here by ID and may **embed frozen snapshots** of the referenced state when standalone consumption matters more than join-freshness. ## Ecosystem - **Upstream raw**: `ppak10/SLS4All-Backup` — full printer backup (`PrintProfiles/`, `PrintSessions/`, `Jobs/`, `Objects/`, etc.). This dataset is a curated, structured slice of that. - **Downstream domain datasets**: - `ppak10/Inova-Mk1-ASTM` — ASTM mechanical-test specimens (D256/D638/D790) + Instron/TestWorks tensile test results. Rows embed printer-state snapshots (e.g. full print profile inline) so ML consumers don't need to cross-join. - `ppak10/Inova-Mk1-Telemetry` (planned). - **Pattern reference**: `ppak10/RocketReviews` uses the same per-entity-config layout (one JSONL per entity, FK fields, `scripts/{entity}/01_*.py`). Match that pattern when adding configs here. ## Architectural decisions - **Per-entity HF configs over nodes+edges parquet.** Each entity (`jobs`, `sessions`, etc.) is its own `config_name` in the README YAML pointing to its own `data/{entity}.jsonl`. Consumers do `load_dataset("ppak10/Inova-Mk1-Database", "jobs")`. The graph is implicit in FK fields, documented in README "Used By" prose. - **No git submodules between HF dataset repos.** HF's `load_dataset` doesn't follow submodules, so consumers gain nothing; the dependency direction is also wrong (Database is the leaf, not the parent). For a one-clone local dev workspace, use a separate non-dataset umbrella repo (e.g. `Inova-Mk1`) with the three datasets as siblings. - **Snapshot vs reference is decided per consumer.** This dataset stores **references** (IDs). Domain datasets choose whether to embed snapshots inline. Default for ML-facing domain datasets: embed the full profile so rows are self-contained. ## Directory layout ``` source/ # raw printer files, mirroring SLS4All app subdirs Jobs/ # .s4a archives (= zip of STLs + .metadata.json) PrintSessions/ # per-run session JSONs PrintProfiles/ # material/energy profile JSONs Objects/ # STL library (Objects/ASTM/ + supporting) scripts/{entity}/ # numbered ETL: 01_extract.py, 02_*.py, ... data/{entity}.jsonl # HF-loadable artifact, one row per record ``` Scaffold: uv (`pyproject.toml`, `.python-version` = 3.10), stdlib only (zipfile, json, re). ## File format notes - **`.s4a`** is just a zip. Contents: the STLs referenced by the job + a `.metadata.json` (~22 KB) embedding the full job state. Inspect with `unzip -p file.s4a .metadata.json | jq`. - **`.metadata.json` `PrintProfile` field is already an ID reference**, not a snapshot — i.e. `AutomaticJob.PrintProfile = {"Id": "..."}`. The full profile data lives only in the standalone `source/PrintProfiles/*.json` files. - **`AutomaticJob.NestingState.PrintProfile`** can be a *different* profile from `AutomaticJob.PrintProfile` — the nesting was computed against one profile, but a different profile may be assigned at print time. Sessions confirm this: the 2026-05-25 `.s4a` job is assigned `52715389` (1 Second Heat Time), but session 1 ran with `25682cd2` (100% Recycled), matching the nesting profile. Worth surfacing both if it ever matters. ## Row shape — `jobs` config ```json { "source_file": "D256 and D638 2026_05_25.s4a", "print_date": "2026-05-25", "job_name": "D256 and D638", "print_profile_id": "52715389-d580-4be9-9194-ed300bdf911b", "objects": [ { "object_file_id": "19b91ed5-d98b-4dee-929b-955b3d757ffc", "name": "d256_impact_specimen.STL", "hash": "AB07BE60702ECFC8F495612DF56280DB63050E72", "instance_count": 8, "scale": 100 } ], "metadata": { "...full .metadata.json..." } } ``` Conventions: light envelope (filename-derived fields at top level), id references surfaced at top level, full raw `metadata` retained for lossless replay. ### IMPORTANT gotcha — object_file_id is per-job, not stable `AutomaticJob.Objects[]` and `AutomaticJob.ObjectFiles[]` are linked only by `Name`. **The same STL file gets a different `ObjectFile.Id` in each job's metadata** — confirmed: `d256_impact_specimen.STL` is `19b91ed5-…` in the 05-25 job and `692f3c49-…` in the 05-30 job. The **content `hash` (SHA1)** is the stable identity. When building the `objects` config, key the node by `hash`, not by `object_file_id`. `object_file_id` is useful only as a per-job handle. ## Current state - `jobs` config — implemented, 4 rows (`scripts/jobs/01_extract.py` → `data/jobs.jsonl`). ## Planned configs | Config | Source | Likely PK | FK refs | |---|---|---|---| | `sessions` | `source/PrintSessions/*.json` | `Id` (session UUID) | `job_id`, `print_profile_id` | | `profiles` | `source/PrintProfiles/*.json` | `Id` (profile UUID) | — | | `objects` | `source/Objects/**/*.STL` | content `hash` (SHA1) | — | ## Scope note Current `source/` holds the **ASTM-subset** carried over from earlier work (4 jobs / 6 sessions / 5 profiles / 5 STLs). If Database is meant to be the canonical printer-side dataset across all domains, broaden by re-pulling from `SLS4All-Backup` before the ASTM-specific filter. ## Adding a new config — recipe 1. `mkdir scripts/{entity}` and write `01_extract.py` (stdlib-only, mirror `scripts/jobs/01_extract.py` layout: ROOT/SOURCE_DIR/OUTPUT_FILE constants, `build_row()`, `main()`). 2. Row shape: top-level filename-derived envelope fields + FK ids + nested `metadata` blob. Surface IDs at top level for HF-side filtering; keep the raw blob for lossless replay. 3. Run script → `data/{entity}.jsonl`. 4. Update `README.md` `configs:` block: add `config_name: {entity}` pointing to the new JSONL. 5. Add the entity row to the README's Configs table.