Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include inter-class and inter-collection relationship graphs in schema documentation #2198

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3d4820b
WIP: Generate `refgraph` visualizations via GHA workflow
eecavanna Sep 27, 2024
9852362
Constrain Python version and regenerate `poetry.lock` file
eecavanna Sep 27, 2024
5ecdcd5
WIP: Inject `refgraph` pages into documentation preview site
eecavanna Sep 27, 2024
ea3794b
Install `refscan` via `pipx` instead of via `poetry`
eecavanna Sep 27, 2024
27754b1
Regenerate `poetry.lock` file (by running `$ poetry lock --no-update`)
eecavanna Sep 27, 2024
9c22098
Use correct directory name
eecavanna Sep 27, 2024
aa4843c
Remove comment to simplify PR diff
eecavanna Sep 27, 2024
80d509d
Remove unnecessary commands from GHA workflow
eecavanna Sep 27, 2024
d8ed9b3
Use `pipx run` to avoid installing anything
eecavanna Sep 27, 2024
4e753b9
Revert unnecessary changes to `poetry.lock` file
eecavanna Sep 27, 2024
9b750e1
WIP: Update site navigation bar so it contains links to graphs
eecavanna Sep 27, 2024
8915b2b
Restrict which `refscan` version will be used
eecavanna Sep 27, 2024
53a7875
Remove comment unrelated to other changes on branch
eecavanna Sep 27, 2024
168a3cc
Standardize comments between doc-related GHA workflows
eecavanna Sep 27, 2024
4da13d4
WIP: Populate project version number before generating derivative files
eecavanna Sep 27, 2024
472270e
Install `refscan` and update `gendoc` Makefile target to run `refgraph`
eecavanna Oct 15, 2024
8acd4c3
Remove `refgraph` step from GHA workflows (is handled by `make gendoc`)
eecavanna Oct 15, 2024
904ff38
Clarify comment
eecavanna Oct 15, 2024
9911c4c
Update sidebar link text to be more descriptive
eecavanna Oct 15, 2024
e5943a9
Introduce "Visualizations" page as an intermediate destination
eecavanna Oct 26, 2024
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
21 changes: 16 additions & 5 deletions .github/workflows/deploy-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ jobs:
- name: Install dependencies.
run: poetry install -E docs

- name: Build and deploy documentation.
# Build the docs and deploy them to GitHub Pages.
- name: Derive files from sources
# Note: First, we replace the "0.0.0" placeholder version number in `pyproject.toml`.
# Reference: https://github.com/mtkennerly/poetry-dynamic-versioning/blob/master/README.md#command-line-mode
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry dynamic-versioning
make squeaky-clean all

- name: Generate web-based documentation
run: |
mkdir -p docs
touch docs/.nojekyll
make gendoc

# Deploy the docs to GitHub Pages.
#
# Note: The `make mkd-gh-deploy` command below uses the `mkd-%` target
# defined in `Makefile`. That target's action (i.e. recipe)
Expand All @@ -34,8 +47,6 @@ jobs:
#
# Reference: https://www.mkdocs.org/user-guide/deploying-your-docs/
#
- name: Deploy web-based documentation to GitHub Pages
run: |
mkdir -p docs
touch docs/.nojekyll
make gendoc
Comment on lines -38 to -40
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: These 3 lines were moved to an earlier step (i.e. to lines 36-38) so that a documentation website file tree exists by the time we try to inject the graphs into it (i.e. on lines 50-51).

make mkd-gh-deploy
14 changes: 11 additions & 3 deletions .github/workflows/test_pages_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ jobs:
- name: Install dependencies
run: poetry install -E docs

- name: Build documentation
- name: Derive files from sources
# Note: First, we replace the "0.0.0" placeholder version number in `pyproject.toml`.
# Reference: https://github.com/mtkennerly/poetry-dynamic-versioning/blob/master/README.md#command-line-mode
run: |
mkdir -p site
touch site/.nojekyll
poetry self add "poetry-dynamic-versioning[plugin]"
poetry dynamic-versioning
make squeaky-clean all

- name: Generate web-based documentation
run: |
mkdir -p docs
touch docs/.nojekyll
make gendoc
poetry run mkdocs build -d site
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that this command is present in this test_pages_build.yaml file, but not in the deploy-docs.yaml file. I don't know why it's necessary in one situation, but not the other. Maybe it's because the author wanted the documentation website's file tree to be generated in a directory named site (instead of—or in addition to—the directory it gets generated in by default).


Expand Down
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,23 @@ $(PYMODEL):
$(DOCDIR):
mkdir -p $@

# Compile static Markdown files, images, and JavaScript scripts, into a documentation website.
#
# Then, use `refgraph` (part of `refscan`) to generate a pair of graphs (i.e. network diagrams),
# one that depicts inter-collection relationships and one that depicts inter-class relationships.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My two cents here is it will be confusing and not very useful to distribute the inter-class relationship diagram until we make the ranges as strict as the structured syntax patterns.

#
gendoc: $(DOCDIR)
# added copying of images and renaming of TEMP.md
cp $(SRC)/docs/*md $(DOCDIR) ; \
cp -r $(SRC)/docs/images $(DOCDIR) ; \
$(RUN) gen-doc -d $(DOCDIR) --template-directory $(SRC)/$(TEMPLATEDIR) --include src/schema/deprecated.yaml $(SOURCE_SCHEMA_PATH)
mkdir -p $(DOCDIR)/javascripts
$(RUN) cp $(SRC)/scripts/*.js $(DOCDIR)/javascripts/
# Use `refgraph` (part of `refscan`) to generate interactive diagrams within the compiled documentation file tree.
# One diagram depicts the relationships between collections and the other depicts the relationships between classes.
mkdir -p $(DOCDIR)/visualizations
$(RUN) refgraph --schema nmdc_schema/nmdc_materialized_patterns.yaml --subject collection --graph $(DOCDIR)/visualizations/collection-graph.html
$(RUN) refgraph --schema nmdc_schema/nmdc_materialized_patterns.yaml --subject class --graph $(DOCDIR)/visualizations/class-graph.html

testdoc: gendoc serve

Expand Down
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ extra_javascript:
- https://unpkg.com/tablesort@5.3.0/dist/tablesort.min.js
- javascripts/tablesort.js
nav:
# Reference: https://www.mkdocs.org/user-guide/configuration/#nav
- NMDC Schema: index.md
- About: about.md
- How to run a collaborative data modeling project: https://linkml.io/linkml/howtos/collaborative-development.html
Expand All @@ -30,6 +31,7 @@ nav:
- NMDC Schema Contributors How-to from Schema Hackathon 2023-12-10: https://docs.google.com/presentation/d/1ZH41QAoESUwAkdHyUxlrmSKS5M-bT0TOulBgX4rBx2A/edit#slide=id.g26390794265_0_693
- NMDC Schema Validation: schema-validation.md
- Schema element deprecation guide: schema_element_deprecation_guide.md
- Visualizations: visualizations.md


site_url: https://microbiomedata.github.io/nmdc-schema
Expand Down
56 changes: 51 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ sheets_and_friends = "^0.5.0" # for do_shuttle (and possibly more)
sparql-burger = "^1.0.2"
sparql-dataframe = "^0.4"
vulture = "^2.11"
refscan = "==0.1.21"


#oaklib = "^0.5.24"
Expand Down
25 changes: 25 additions & 0 deletions src/docs/visualizations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Visualizations

## Inter-collection relationship diagram

<!-- Note: `visualizations/collection-graph.html` does not exist in the source code repository.
It gets generated as part of the documentation build process. -->
This [**inter-collection relationship diagram**](visualizations/collection-graph.html)
shows the database **collections** described by the schema, and the **relationships** between those collections.

Each circle represents a collection.
Each arrow represents all of the fields that documents in one collection—the one at that arrow's tail—can
use to refer to documents in another collection—the one at that arrow's head.
If you click on a circle, the names of the fields will appear on the arrows connected to that circle.

## Inter-class relationship diagram

<!-- Note: `visualizations/class-graph.html` does not exist in the source code repository.
It gets generated as part of the documentation build process. -->
This [**inter-class relationship diagram**](visualizations/class-graph.html)
shows the **classes** defined within the schema, and the **relationships** between those classes.

Each circle represents a class.
Each arrow represents all of the slots that instances of that class—the one at that arrow's tail—can
use to refer to instances of another class—the one at that arrow's head.
If you click on a circle, the names of the slots will appear on the arrows connected to that circle.
Loading