# 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). The umbrella role is filled by the recorder repo (`Agentic-Additive-Manufacturing-Process-Optimization`), which contains this repo, ASTM, and Telemetry as submodules under `datasets/` (all `update = none` — init explicitly); the datasets stay siblings of each other there. - **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, 21 rows (`scripts/jobs/01_extract.py` → `data/jobs.jsonl`). Covers every 2026-dated print from 2026-05-25 through 2026-07-12 (including non-ASTM Hex Coasters / Nameplates / DragonBurner Cowl side prints). - Two dates carry two jobs each: 2026-06-27 (`D790 and D638 and other objects` + `Hex Coasters and Nameplates and Benchies`) and 2026-06-29 (`Debug Run` + `Nameplate`). Downstream lookups need to key by `job_id` or filter by object hash — a naive date-key lookup will pick whichever job happened to be extracted last. ## 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 all **2026-dated** prints from SLS4All-Backup: 21 jobs / 42 sessions / 15 profiles. That's every print the backup has for 2026, including the non-ASTM side jobs (Hex Coasters, Nameplates, DragonBurner Cowl, Bucky). 2025-dated jobs (Bookmarks, Trophy Prints, T-Rex, etc.) are intentionally out of scope — they predate the current ASTM/Telemetry data-collection period. Loose STL geometry lives in `source/Objects/ASTM/` and is still ASTM-only (4 files); the STLs used by each print job are embedded inside the corresponding `.s4a` archive, so the `jobs` config is self-contained. If a future `objects` config wants to enumerate all STLs, it will need to either extract from the `.s4a` files or import the broader `SLS4All-Backup/Objects/` tree. Backfill trail (chronological): - 2026-07-11: imported 06-09 Cards + 06-13 Recycled Powder → ASTM batches F ← 06-13, G ← 06-09. - 2026-07-12: full 2026 sweep + backup refresh through 07-12 → ASTM batches E D790 ← 06-07, H ← 06-24, I ← 06-25, J/J_MB ← 06-27 (the `D790 and D638 and other objects` job, disambiguated from same-day Hex Coasters via STL-content match in the ASTM `_lib`). ## 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.