Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/documentation-links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .github/workflows/documentation-links.yml

name: readthedocs/actions
on:
pull_request_target:
types:
- opened
# Execute this action only on PRs that touch
# documentation files
paths:
- "docs/**"

permissions:
pull-requests: write

jobs:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
# this is the slug from the non-redirected URL (scicomp-docs.readthedocs.io)
project-slug: "aind-data-schema"
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ notebook/
ephys_instrument.json
examples/*.json
*.json
!diagram-app/package.json
!diagram-app/package-lock.json
!diagram-app/tsconfig.json

# diagram-app (React Flow schema diagram embedded in the docs front page)
diagram-app/node_modules/
docs/source/_static/schema-diagram/
docs/base/models/*
.github/copilot-instructions.md
uv.lock
schema_tree.md
schema_tree.tex
8 changes: 8 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ build:
os: ubuntu-22.04
tools:
python: "3.13"
nodejs: "20"
jobs:
# Build the interactive React Flow schema diagram bundle into
# docs/source/_static/ before Sphinx runs (the bundle is git-ignored and
# regenerated here; the JSON it fetches is generated by conf.py).
pre_build:
- npm --prefix diagram-app ci
- npm --prefix diagram-app run build

python:
install:
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,21 @@ python src/aind_data_schema/utils/docs/registries_generator.py
python src/aind_data_schema/utils/docs/doc_generator.py
```

The front page embeds an interactive React Flow diagram of the `Metadata` schema (`diagram-app/`). Build its JS/CSS bundle once before building the docs (it's git-ignored and only needs rebuilding when `diagram-app/` changes):

```bash
npm --prefix diagram-app ci
npm --prefix diagram-app run build
```

Then to create the documentation html files, run:

```bash
sphinx-build -b html docs/source/ docs/build/html
```

This also (re)generates `docs/source/_static/schema-diagram/schema_diagram.json`, the data the diagram reads at runtime, from the current schema classes.

More info on sphinx installation can be found here: https://www.sphinx-doc.org/en/master/usage/installation.html

### Testing
Expand Down
16 changes: 16 additions & 0 deletions diagram-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aind-data-schema diagram (dev)</title>
<style>
html, body { margin: 0; height: 100%; font-family: system-ui, sans-serif; }
</style>
</head>
<body>
<!-- In the docs this div is injected by a raw-HTML block; here it drives the dev server. -->
<div class="rf-schema-diagram" style="height: 100vh"></div>
<script type="module" src="/src/main-viewer.tsx"></script>
</body>
</html>
Loading