Skip to content

Conversation

@yarikoptic
Copy link
Contributor

@yarikoptic yarikoptic commented Feb 21, 2025

This is based of the mermaid diagrams in the blog post we have: https://bids-website.readthedocs.io/en/latest/blog/2024/11/13/bids-validator-2.html and the goal is to give a visual depiction of relations between the components mentioned on this page and elsewhere.

Here is a screenshot of preview. I do agree that text is a bit small'ish, so we might want to prune it but it is quite usable and IMHO useful... May be there is a way to make it "full screen"?

version1: horizontal, harder to read, no zooming etc

image

version2: vertical

image

version3: removed bids-apps and stats-models:

image

TODOs

@Remi-Gau
Copy link
Contributor

I would remove the legacy validator from that diagram.
Will simplify the whole thing.

@Remi-Gau
Copy link
Contributor

The preview on read the docs shows a mermaid syntax error.

This does not mean there is a real syntax error but that's the kind of problem when I was trying to use some of the more advanced mermaid features with mkdocs.

@effigies
Copy link
Contributor

@yarikoptic
Copy link
Contributor Author

  • it is likely the requirement to have newer mkdocs-material ... learning about us using pip-compile... let's see if helps

  • re legacy one: I think it might still be worth being there for a year or so since many could still "relate" to it and here it explicitly depicts it... so "not sure" about removal just yet.

@yarikoptic
Copy link
Contributor Author

FWIW: does render now.

@effigies
Copy link
Contributor

Looks like too much stuff going on. I can't read it at 100% zoom.

image
image

@yarikoptic
Copy link
Contributor Author

@candleindark -- would you be so kind to see if you could tame the drawing so it is of better fidelity without zooming?

Meanwhile, I have added here use of panzoom plugin (https://playg0n.github.io/mkdocs-panzoom/) which should enable zoom'ing "Mermaid and D2 are included by default". Seems to work nicely.

@candleindark
Copy link

@candleindark -- would you be so kind to see if you could tame the drawing so it is of better fidelity without zooming?

I think the problem stems having too many items in the graph rather the arrangement of the items in the graph, but I will make an attempt. It would be nice if there is some mermaid support that allows zooming in of a particular region of the diagram, like the behavior of the prezi app.

I don't think this problem is particular to us though. Many linkml generated diagrams suffer the same problem in presentation (For example, https://concepts.datalad.org/s/temporal/unreleased/).

@candleindark
Copy link

I think if we can get any large mermaid diagram to display in full window as https://anvaka.github.io/panzoom/demo/index.html would be great.

The example is a live demo of https://github.com/anvaka/panzoom which is the base for https://playg0n.github.io/mkdocs-panzoom/

@yarikoptic
Copy link
Contributor Author

@candleindark I already added zoom/dragging here -- check preview at https://bids-website--626.org.readthedocs.build/en/626/standards/index.html . Do you propose something instead/on top of it?

@candleindark
Copy link

@candleindark I already added zoom/dragging here -- check preview at https://bids-website--626.org.readthedocs.build/en/626/standards/index.html . Do you propose something instead/on top of it?

In a way, yes. I do think the one I mentioned is more better, but it is not a Mkdocs extension. I don't know if it's worth the time/effort to get it working.

@candleindark
Copy link

@candleindark I already added zoom/dragging here -- check preview at https://bids-website--626.org.readthedocs.build/en/626/standards/index.html . Do you propose something instead/on top of it?

In a way, yes. I do think the one I mentioned is more better, but it is not a Mkdocs extension. I don't know if it's worth the time/effort to get it working.

Nevermind, I just found out some a feature of the mkdocs extension you are using. I think it is good enough.

@candleindark
Copy link

@yarikoptic I was able to make the items in the diagram appear a bit larger and sent a PR to your branch.

@yarikoptic
Copy link
Contributor Author

@effigies please check it out now : https://bids-website--626.org.readthedocs.build/en/626/standards/index.html . I also updated screenshot in original description

@Remi-Gau
Copy link
Contributor

Remi-Gau commented Mar 1, 2025

  • re legacy one: I think it might still be worth being there for a year or so since many could still "relate" to it and here it explicitly depicts it... so "not sure" about removal just yet.

we will forget to remove it in a year

it useless complexifes the figure that is already WAY too complex in my opinion

we have no intention of keeping maintaining the old validator, so let's not emphasize it

the original blog post gradually explained things and complexified the figure incrementally: I think that the landing page for 'standards' should have a simpler version and we can put the more exhaustive version somewhere else

@effigies
Copy link
Contributor

effigies commented Mar 1, 2025

Just a thought sparked by @Remi-Gau's comment: what if this also was a blog post that came with explanations and is tagged with an author and date?

I haven't reviewed, but I feel like the editorial bar is lower for a blog post than a landing page.

@Remi-Gau
Copy link
Contributor

Remi-Gau commented Mar 1, 2025

Just a thought sparked by @Remi-Gau's comment: what if this also was a blog post that came with explanations and is tagged with an author and date?

I haven't reviewed, but I feel like the editorial bar is lower for a blog post than a landing page.

I like the idea and we can have the simplified version in the landing page and pointing to the blog post for anyone who wants the gory details

@yarikoptic
Copy link
Contributor Author

I think it is a good idea -- indeed could be a more descriptive blog post describing the situation, pointing to the blog post with more details on validators of the past. Coolio, we will move into a blog post. Thanks @effigies and @Remi-Gau . I will just move it to draft for now then

@yarikoptic yarikoptic marked this pull request as draft March 2, 2025 04:58
@yarikoptic yarikoptic marked this pull request as ready for review May 9, 2025 15:22
@yarikoptic
Copy link
Contributor Author

Idea for a blog is neat but I do not think it is to materialize any time soon. So I am making this PR a candidate for merge - "perfect is enemy of the good" and I had a second look at the diagram and still find it useful to orient visitor in all the intricacies of dependencies, with URL hyperlinks coming quite handy.

@yarikoptic yarikoptic requested a review from ericearl May 9, 2025 15:23
yarikoptic added a commit to dandi/dandi-archive that referenced this pull request May 15, 2025
Metadata lifecycle inspired by the one we created for BIDS:
see bids-standard/bids-website#626
yarikoptic and others added 8 commits August 21, 2025 15:03
…n and validators

This is based of the mermaid diagrams in the blog post we have:
https://bids-website.readthedocs.io/en/latest/blog/2024/11/13/bids-validator-2.html
and the goal is to give a visual depiction of relations between the components
mentioned on this page and elsewhere.
This adjustment will allow items in the
mermaid diagram to appear bigger in the
webpage because the page is more limited
in the horizontal dimension. Additionally,
the syntax of the mermaid diagram has been
updated to the latest syntax,
e.g. `flowchart` instead of `graph`.
The intents of the lines in the diagram
are those recommended/defaulted by the
mermaid live editor at
https://www.mermaidchart.com
jjnesbitt added a commit to dandi/dandi-archive that referenced this pull request Oct 7, 2025
* Design document with a diagram of metadata life cycle

Metadata lifecycle inspired by the one we created for BIDS:
see bids-standard/bids-website#626

* Remove duplication with now present vendorization issue

* Address all questions and detail implementation more

* Implement local schema serialization endpoints

- Add new API endpoints to serialize JSONSchema at runtime
- Update info endpoint to use local schema URL instead of GitHub
- Use TypeAdapter for proper Pydantic schema generation
- Add tests for schema endpoints
- Add implementation documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* doc: Add mermaid diagram for updated schema architecture

- Add visual representation of the new schema flow
- Highlight key differences from the current approach
- Show elimination of dependency on external schema repository

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* Provide custom name for django testserver instance

The default name django uses is "testserver" and then URL becomes
http://testserver, but DJANGO itself does not consider it to be a valid URL
because it lacks TLD.  So whenever we add "schema_url" pointing to our server
(in tests just "testserver") DJANGO starts raising validation errors.

See encode/django-rest-framework#9705
for more information/rationale.

* RF: refactor auto-AI-generated tests into parametrized ones

to concetrate the testing logic and also to accent on the differences (parameters of the test)

* Add GitHub schema comparison to test_schema_latest

Extends test to compare local runtime-generated schema against static GitHub
schema content. This test is expected to fail, demonstrating that vendorized
schemas differ from static schemas due to runtime customizations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* Use TransitionalGenerateJsonSchema with proper type annotations

Refactors schema generation to match dandischema approach and adds type
safety.

* Fix schema endpoints to use regular Dandiset/Asset models

Changes from Published models to regular models to match GitHub static schemas:
- Use Dandiset instead of PublishedDandiset
- Use Asset instead of PublishedAsset
- Update test parameterization accordingly

Test now shows minimal vendorization difference (repository default value)
demonstrating the expected runtime customization vs static schema difference.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* Adjust test to handle vendorization differences

Add logic to normalize vendorization differences before schema comparison:
- Adjust repository default value from runtime config to match GitHub schema
- Test now passes, confirming schemas are equivalent after vendorization adjustment
- Demonstrates successful runtime schema generation with expected customizations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* Add published schema endpoints and refactor to reduce code duplication

Extends the schema API to support both regular and published models:

New endpoints:
- /api/schema/latest/published-dandiset/
- /api/schema/<version>/published-dandiset/
- /api/schema/latest/published-asset/
- /api/schema/<version>/published-asset/

Refactoring improvements:
- Extract common logic into _schema_view_impl() helper function
- Update URL patterns and view exports

Testing enhancements:
- Extend parametrized tests to cover published schema endpoints

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>

* Fixup to mermaid diagram

In d41f24e I committed a little rushed
tune up by claude and it replaced "current state" diagram with the actually
implemented, and then for implemented it just removed having jsonschema
serializations altogether.

Since we did merges into this branch, rebasing is "tricky", so I decided to
just push a fixup commit.

* Remove portion of the test checking for identity to released schemas

* chore: remove unused import

This resolve a complain from ruff

* style: use `settings.DANDI_API_URL` to construct schema URL

There are already consistent uses of
`settings.DANDI_API_URL` for building URLs in
the codebase.
Check out
#2386 (comment) detailed rationale behind
this change.

Co-authored-by: Mike VanDenburgh <[email protected]>

* Don't re-implement get_schema_url in tests

* Unify schema endpoints

* Remove version query param from schema endpoint

* Update wording

Co-authored-by: Isaac To <[email protected]>

* Add test against unsupported model values

* Update schema endpoint swagger docs

* Add endpoint for listing available models

* Fix view import/export

* feat: change endpoints related to serving schemas

* doc: update design docs regarding endpoint changes.

* docs: remove mention of `TypeAdapter` in `vendored-schema-1-implementation.md`

Pydantic models can generate their own JSONSchema,
and we do generate the JSONSchema directly from the
models. TypeAdapter in Pydantic has other uses,
but we are not using it here.

* docs: consolidate vendor-configurable metadata models design docs into one file

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: Mike VanDenburgh <[email protected]>
Co-authored-by: Isaac To <[email protected]>
Co-authored-by: Isaac To <[email protected]>
Co-authored-by: Mike VanDenburgh <[email protected]>
Co-authored-by: Jacob Nesbitt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend mermaid figure(s) for validator?

4 participants