Gallery › dataclass viewer › Dataclass viewer: facility inputs

Dataclass viewer: facility inputs

The kinematic sim's facility inputs, BASE_FACILITY and the belt and pick move it references, as an outline that folds, a sheet per field with its range, basis and source, a form that edits a value inside its range, and the viewer's Rows table.

dataclass viewerlistrecordtable6 views of one facility.json

The .base file and its data

Every tab above is one entry of this file; the views read these rows. ⋯ in the toolbar copies the current view as YAML.

# The kinematic-sim facility inputs: py_dataclass_viewer's Outline, Sheet and Controls views (py_dataclass_viewer/
# static/app.js) over BASE_FACILITY as rows. Obsidian Bases grammar plus data-ui's keys (docs/CONTRACT.md §5).
data: facility.json
views:
  - type: list
    name: Outline
    tree: { parent: parent }
    order: [name, value, refers_to]
    markers: none
    separator: "  "
  - type: list
    name: Outline with sources
    tree: { parent: parent }
    order: [name, value, measured_by, file]
    markers: none
    indentProperties: true
  - type: record
    name: Field
    filters: 'kind == "value"'
    record:
      sections:
        - { name: Value, properties: [value, measured_by] }
        - { name: Where it lives, properties: [path, class, type, file, hidden] }
  - type: record
    name: Edit
    filters: 'kind == "value"'
    edit: true
    record:
      sections:
        - { name: Value, properties: [value, measured_by] }
        - { name: Where it lives, properties: [path, file] }
  - type: table
    name: Rows
    filters: 'kind == "value"'
    order: [name, value, measured_by, file]
    groupBy: { property: class }
    edit: true
    record:
      sections:
        - { name: Value, properties: [value, measured_by] }
        - { name: Where it lives, properties: [path, file] }
  - type: table
    name: Outline table
    tree: { parent: parent }
    order: [name, value, kind, measured_by, file]
// facility.json: 16 rows, 9 KB; the first 3
{
 "id": "kinsim-facility",
 "title": "Kinematic-sim facility inputs",
 "titleProperty": "name",
 "source": "py_dataclass_viewer examples/10_kinsim_inputs (facility.py, belt.py, pick.py): BASE_FACILITY",
 "properties": {
  "name": {
   "type": "text",
   "label": "Field",
   "readOnly": true
  },
  "path": {
   "type": "text",
   "label": "Path",
   "readOnly": true,
   "note": "the dotted name the viewer's edit API addresses"
  },
  "parent": {
   "type": "text",
   "label": "Parent",
   "hidden": true,
   "readOnly": true
  },
  "kind": {
   "type": "text",
   "label": "Kind",
   "display": "badge",
   "readOnly": true,
   "colors": {
    "instance": 7,
    "reference": 1,
    "nested": 3,
    "value": 0
   }
  },
  "class": {
   "type": "text",
   "label": "Class",
   "readOnly": true
  },
  "type": {
   "type": "text",
   "label": "Type",
   "readOnly": true
  },
  "value": {
   "type": "number",
   "label": "Value",
   "note": "Value(value, unit, low=, high=, basis=, source=, notes=)"
  },
  "measured_by": {
   "type": "text",
   "label": "Measured by",
   "note": "what will measure it (the Value's measured_by)"
  },
  "refers_to": {
   "type": "text",
   "label": "Refers to",
   "readOnly": true
  },
  "file": {
   "type": "text",
   "label": "File",
   "readOnly": true
  },
  "hidden": {
   "type": "boolean",
   "label": "Hidden in the view",
   "readOnly": true,
   "note": "the class's view_hidden"
  }
 },
 "rows": [
  {
   "id": "BASE_FACILITY",
   "name": "BASE_FACILITY",
   "path": "BASE_FACILITY",
   "parent": null,
   "kind": "instance",
   "class": "Facility",
   "type": "Facility",
   "value": null,
   "measured_by": null,
   "file": "facility.py",
   "hidden": false,
   "refers_to": null
  },
  {
   "id": "BASE_FACILITY.belt",
   "name": "belt",
   "path": "BASE_FACILITY.belt",
   "parent": "BASE_FACILITY",
   "kind": "reference",
   "class": "Belt",
   "type": "Belt",
   "value": null,
   "measured_by": null,
   "file": "belt.py",
   "hidden": false,
   "refers_to": "DEFAULT_BELT"
  },
  {
   "id": "BASE_FACILITY.belt.width_m",
   "name": "width_m",
   "path": "BASE_FACILITY.belt.width_m",
   "parent": "BASE_FACILITY.belt",
   "kind": "value",
   "class": "Belt",
   "type": "float",
   "value": {
    "value": 1.2,
    "unit": "m",
    "low": 0.6,
    "high": 1.85,
    "basis": "chosen",
    "source": "chosen; Remcon sort belts 0.3-1.8 m, [ZenRobotics](https://www.terex.com/zenrobotics) up to 1.85 m; see [[Facility Model — Hand Calc Then Simulate (2026-10-04)]]",
    "note": "A chosen design input, not a measurement: belt width is capped by the arm's reach across, and the sim sweeps it between low and high."
   },
   "measured_by": null,
   "file": "belt.py",
   "hidden": false,
   "refers_to": null
  }
 ]
}
README.md
# Dataclass viewer: facility inputs

The kinematic sim's facility inputs, `BASE_FACILITY` and the belt and pick move it references, as an outline that
folds, a sheet per field with its range, basis and source, a form that edits a value inside its range, and the
viewer's Rows table.

- **App:** dataclass viewer
- **Replaces:** the hand-rolled data views of py_dataclass_viewer (`static/app.js` in `~/py_dataclass_viewer`):
  the Outline (`outlineView`, `treeNodes`), the Sheet and the Controls (`controlsView`, `ctlRow`). The viewer keeps
  its file tree, its CodeMirror source and its byte-splice writes; the views over the values are the kit's.
- **Shows:** `type: list` with `tree: {parent}` (an outline; references and nested classes fold),
  `indentProperties`, the same outline as a table (`type: table` with `tree:`), `type: record` with sections (each `Value(...)` as a value, its range, basis mark and source),
  and `edit: true`: a number input bounded by the Value's own `low` / `high`, structural fields read-only. This case's `site.json` makes the page
  `editable`, so a save lands in memory and shows in every view; a read-only host refuses it and says why. In the
  viewer, the host's `acceptEdit` would be its `apply()`. The Rows table carries the same `record.sections` and
  `edit: true`, so a row's side peek is that form too (the viewer's Controls beside its rows).
- **Data:** `facility.json`, 16 rows written by `source/make.py`, which imports the viewer's own example
  `examples/10_kinsim_inputs` (`facility.py`, `belt.py`, `pick.py`) and walks `BASE_FACILITY`. Real values and
  sources from the kin-sim scenarios; `measured_by` says what will measure each one.

The original UI it replaces

the hand-rolled data views of py_dataclass_viewer (static/app.js in ~/py_dataclass_viewer): the Outline (outlineView, treeNodes), the Sheet and the Controls (controlsView, ctlRow). The viewer keeps its file tree, its CodeMirror source and its byte-splice writes; the views over the values are the kit's.

What it shows

type: list with tree: {parent} (an outline; references and nested classes fold), indentProperties, the same outline as a table (type: table with tree:), type: record with sections (each Value(...) as a value, its range, basis mark and source), and edit: true: a number input bounded by the Value's own low / high, structural fields read-only. This case's site.json makes the page editable, so a save lands in memory and shows in every view; a read-only host refuses it and says why. In the viewer, the host's acceptEdit would be its apply(). The Rows table carries the same record.sections and edit: true, so a row's side peek is that form too (the viewer's Controls beside its rows).

Data

facility.json, 16 rows written by source/make.py, which imports the viewer's own example examples/10_kinsim_inputs (facility.py, belt.py, pick.py) and walks BASE_FACILITY. Real values and sources from the kin-sim scenarios; measured_by says what will measure each one.