This repository now includes a TOML-first pipeline for turning a curated hardware model into:
- a normalized SQLite database of systems, subsystems, component types, fields, QC artifacts, and relationships
- Mermaid graphs for hierarchy views
- Mermaid graphs for dependency views
- Mermaid graphs for cable and interface views
- styled SVG and PDF publication diagrams
The design is intentionally TOML-first:
- A curated spec layer in
specs/systemsdefines the canonical model. - That model gets loaded into SQLite and rendered as diagrams and publication outputs.
- Optional local source extraction exists only for provenance or one-time analysis.
This avoids treating draft prose as the database of record. The TOML specs are the source of truth.
.
├── docs/ # design notes and planning documents
├── source-material/ # optional local-only private input documents, ignored by git
├── specs/systems/ # canonical system model in TOML
├── tools/ # CLI for DB build and rendering
├── build/ # generated outputs, ignored by git
├── .gitignore
├── Makefile
└── README.md
Edit the model here:
specs/systems: canonical system definitionsdocs/hwdb-plan.md: design notes and extension plan
Do not edit generated outputs in:
build/build/diagrams/build/publish/
Those files are regenerated from the specs.
Optional private reference documents belong in:
That folder is intentionally ignored by git, so the original .docx, .pptx, and .xlsx files are kept local only. They are not required for building the repo outputs.
python3 tools/hwdb.py build-db
python3 tools/hwdb.py publishEquivalent convenience targets:
make build
make publish
make allTo generate the static HTML portfolio into docs/:
make siteThis also writes the interactive database explorer:
docs/explorer.htmldocs/systems/*.htmldocs/views/*.htmldocs/data/hwdb-index.jsondocs/data/systems/*.jsondocs/data/hwdb-index.jsdocs/data/systems/*.jsdocs/assets/explorer.cssdocs/assets/explorer.jsdocs/assets/viewer.jsdocs/assets/diagram-dialog.js
The generated pages use static HTML5, CSS, and vanilla JavaScript. The explorer loads the system index first and then loads per-system data chunks on demand, so it can grow without embedding the whole database in one HTML file. Hosted pages use JSON fetches; direct file:// previews fall back to generated JavaScript data chunks. The index page provides overview previews, docs/systems/*.html pages step from simple overview diagrams into hierarchy, dependency, and cabling trees, and docs/views/*.html pages give each diagram a full-page viewport with fit/width/zoom controls. Clicking system, subsystem, component, or relation objects in the publication diagrams opens an in-page database dialog backed by the same generated data chunks; docs/explorer.html remains available for full table-style querying and stable #object=... deep links.
When changing hierarchy, dependencies, cables, fields, or QC artifacts:
- Edit the relevant TOML file in
specs/systems/ - Rebuild the SQLite database
- Regenerate the published diagrams
- Inspect the dense detector plate and the per-system diagrams
python3 tools/hwdb.py build-db
python3 tools/hwdb.py publishpython3 tools/hwdb.py list
sqlite3 build/hardware.db '.tables'python3 tools/hwdb.py build-db
python3 tools/hwdb.py list
python3 tools/hwdb.py render-all
python3 tools/hwdb.py publishNo document extraction is required for the normal workflow.
If you want local text snapshots from private DOCX, PPTX, and XLSX source files for provenance only:
python3 tools/hwdb.py extract-sources
make extract-legacypython3 tools/hwdb.py graph --system fd2_vd_overview --view overview
python3 tools/hwdb.py graph --system fd2_vd_top_crp --view hierarchy
python3 tools/hwdb.py graph --system fd2_vd_tde --view cabling
python3 tools/hwdb.py graph --system fd2_vd_ci --view dependencyRender one publishable SVG or PDF directly:
python3 tools/hwdb.py render-svg --system fd2_vd_tde --view cabling
python3 tools/hwdb.py render-svg --system fd2_vd_top_crp --view hierarchy --pdf-output build/publish/pdf/top_crp_hierarchy_manual.pdfGenerate a GitHub Pages-compatible static site in docs/:
make siteThis writes:
docs/index.htmldocs/explorer.htmldocs/systems/*.htmldocs/views/*.htmldocs/assets/report.cssdocs/assets/explorer.cssdocs/assets/explorer.jsdocs/assets/viewer.jsdocs/assets/diagram-dialog.jsdocs/data/hwdb-index.jsondocs/data/systems/*.jsondocs/data/hwdb-index.jsdocs/data/systems/*.jsdocs/diagrams/*.svgdocs/pdf/*.pdfdocs/dot/*.dot
Generated outputs land in build/:
build/hardware.dbbuild/diagrams/*.mmdbuild/publish/index.htmlbuild/publish/diagrams/fd2_vd_full_dense.svgbuild/publish/diagrams/*.svgbuild/publish/pdf/*.pdf
Optional provenance outputs, if you run the extractor:
build/sources/index.jsonbuild/sources/*.txt
The main report to open in a browser is:
build/publish/index.html
The dense full-system publication graphic is:
build/publish/diagrams/fd2_vd_full_dense.svgbuild/publish/pdf/fd2_vd_full_dense.pdf
The database currently stores:
sources: optional extracted document recordssystemssubsystemscomponent_typesfieldsartifactsrelations
The seeded specs cover:
- FD2-VD detector overview
- FD2-VD Top CRP
- FD2-VD TDE
- FD2-VD Cryogenic Instrumentation
- FD2-VD HV Cathode
- Prefer keeping keys stable
- Change labels and descriptions freely
- Change a key only if you intend a real structural rename
For example:
- safe: change
name = "Top Half CRP / CRU"to a better display label - risky: change
key = "cru"unless you also update all relations that reference it
In a system spec:
- Add the component under
[[components]] - Assign it to a subsystem if relevant
- Add fields and artifacts if needed
- Add at least one relation so it appears in diagrams
Use typed relations instead of free text:
containsconnects_tointerfaces_withreads_outpowerstimed_bydepends_on
These relation types are what drive the plotting views.
- Copy an existing TOML file in
specs/systems/ - Define the
[system]block - Add
[[subsystems]] - Add
[[components]] - Add
[[relations]] - Run
build-db - Run
publish
If you want plots to stay stable and reproducible:
- treat the TOML specs as the only editable source of truth
- avoid hand-editing SVG, PDF, Mermaid, or DOT outputs
- keep relation types consistent
- keep keys stable across edits
- add structure first, then refine labels
- use
publishafter every meaningful schema change
Graph layout is automatic, so small visual shifts can happen as the graph grows. If the dense diagrams become too unstable, the next improvement should be adding explicit layout metadata to the spec layer.
The interface documents mix:
- stable structure
- open action items
- future relationship changes by installation phase
- QC intent
- cable procedures
That makes direct document parsing useful for indexing, but not reliable enough to be the canonical schema. The spec layer is the canonical model; the documents remain the evidence.
The published report groups outputs by system and by view:
Overview: high-level framing for a systemHierarchy: parent-child assembly structureDependencies: cross-functional links between itemsCabling: cable, fiber, timing, and interface paths
The dense detector plate is the closest output to the hierarchy PowerPoint decks in this folder. It combines the modeled systems into one publication-style graphic.
Usually one of these is true:
- it has no relation
- it is filtered out by the selected view
- the build was not rerun after editing
Typical causes:
- a relation references a key that does not exist
- a component references a subsystem key that does not exist
- malformed TOML syntax
The publisher depends on Graphviz dot. Check:
command -v dotThis is only relevant if you intentionally run the legacy extractor. Check that the private source documents are under source-material/:
find source-material -maxdepth 1 -type f- The dense full-system plate is only as complete as the seeded specs
- Some systems in the source folder are still represented only as context, not full internal models
- The current database is type-level, not PID-level
- There is not yet a subsystem DSM matrix layer in the schema
- Add more system specs in
specs/systems - Add PID-level instance tables once real part inventories are available
- Add connector and cable-end tables if you want channel-level mapping
- Add schedule/task specs if you want Mermaid Gantt output from the same database