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

Fixing JSON Schema not Rendering Properly in the Documentation #1594

Merged

Conversation

DhruvSondhi
Copy link
Contributor

@DhruvSondhi DhruvSondhi commented May 29, 2021

This PR aims to fix the JSON Schema parsing error present in the Documentation.

Documentation : https://dhruvsondhi.github.io/tardis/branch/jsonschema_documentation/using/components/configuration/configuration.html#configuration-schema

Description

The documentation contains references to the JSON Schema. This is not correctly parsed by the sphinx jsonschema extension & hence raises many warnings.
This PR restructures the JSON Schema to make it possible to render these in the documentation.
Testing needs to be done.

Motivation and context

This will allow for easier linking of the schema in the Documentation. Will allow easier access for the schema to new users

How has this been tested?

  • Testing pipeline.
  • Other.

Type of change

  • Bug fix.
  • New feature.
  • Breaking change.
  • None of the above.

Checklist

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
    • (optional) I have built the documentation on my fork following the instructions.
  • I have assigned and requested two reviewers for this pull request.

@codecov
Copy link

codecov bot commented May 29, 2021

Codecov Report

Merging #1594 (dcc3fed) into master (2bba59c) will not change coverage.
The diff coverage is n/a.

❗ Current head dcc3fed differs from pull request most recent head 06a5f23. Consider uploading reports for the commit 06a5f23 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1594   +/-   ##
=======================================
  Coverage   67.20%   67.20%           
=======================================
  Files          73       73           
  Lines        6150     6150           
=======================================
  Hits         4133     4133           
  Misses       2017     2017           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2bba59c...06a5f23. Read the comment docs.

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

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

This makes page much clear than before. It will be great if you can also introduce proper hierarchy in "Model" section. The TOC after addressing my comments will be:

Model

  • Abundances
    • File Abundance
    • Uniform Abundance
  • Structure
    • File Structure
    • Specific Structure
      • Densities
        • Branch85_w7 Density
        • Exponential Density
        • Power_law Density
        • Uniform Density

docs/using/components/configuration/configuration.rst Outdated Show resolved Hide resolved
@@ -74,7 +90,6 @@ The rest of the section can be used to configure uniform abundances for all shel
relative abundance fraction. If it does not add up to 1., TARDIS will warn --- but normalize the numbers.
Copy link
Member

Choose a reason for hiding this comment

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

L69-L74 (in current file) will also go up, right after L58 (in your changed file) - they together explain about abundances.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, Didn't know how they linked. I will move it to the requested place 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry @jaladh-singhal, Can you please re-iterate this change once I push the updated file?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see them moved up. You just need to Ctrl+X this content from "..warning:: ..... normalize the numbers" and Ctrl+V right after "The abundance section ..... a file containing the abundance information."

docs/using/components/configuration/configuration.rst Outdated Show resolved Hide resolved
docs/using/components/configuration/configuration.rst Outdated Show resolved Hide resolved
@DhruvSondhi
Copy link
Contributor Author

On the same lines, do we need to restructure the abstracts in the Montecarlo Convergence Strategies?

@jaladh-singhal
Copy link
Member

On the same lines, do we need to restructure the abstracts in the Montecarlo Convergence Strategies?

Actually that needs to be rewritten because convergence_criteria no longer exists (most probably it needs to be changed to convergence_strategy) and the paragraph ends incompletely - I'll create an issue once this is merged it needs to be done by someone with physics background.

@isaacgsmith
Copy link
Member

On the same lines, do we need to restructure the abstracts in the Montecarlo Convergence Strategies?

Actually that needs to be rewritten because convergence_criteria no longer exists (most probably it needs to be changed to convergence_strategy) and the paragraph ends incompletely - I'll create an issue once this is merged it needs to be done by someone with physics background.

That's related to some work I will be doing soon, so I am going to be looking into that.

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

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

Thanks for making changes - there are few things still left.

Besides, (it should not be implemented in this PR) but sphinx-rtd-theme has very small font-size differences from h4 to h6 making it visually hard to distinguish these heading levels - maybe we can override corresponding CSS in config.

@@ -74,7 +90,6 @@ The rest of the section can be used to configure uniform abundances for all shel
relative abundance fraction. If it does not add up to 1., TARDIS will warn --- but normalize the numbers.
Copy link
Member

Choose a reason for hiding this comment

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

I don't see them moved up. You just need to Ctrl+X this content from "..warning:: ..... normalize the numbers" and Ctrl+V right after "The abundance section ..... a file containing the abundance information."

Comment on lines +77 to +86
Densities
"""""""""
Copy link
Member

Choose a reason for hiding this comment

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

Actually, densities should be a subsection of "Specific Structure" (as you can compare my proposed TOC with your rendered TOC after these changes) - I know it seems awkward but is it possible to somehow nest it within specific structure schema (L75)'s title?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to be difficult as we are on <H6> at the moment on those heading. I don't think we can move it under the section 🤔 . What are your opinions, @jaladh-singhal ?
https://documentation-style-guide-sphinx.readthedocs.io/en/latest/style-guide.html#headings ---> Reference to the heading hierarchy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have it set up so that the Density section is under the Structure Section but it seems so that it is not being generated correctly 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, the jsonschema extension is creating the appropriate headings based on the schema that I have linked. I don't think I can make it so that the Density subsection comes under the Specific Structure section because the Specific Structure is at <H6> & Density is also at <H6>.

Copy link
Member

Choose a reason for hiding this comment

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

@DhruvSondhi I checked it in web inspector before commenting that:

  • Structure is at H4
    • File Structure is at H5
    • Densities is at H5
      • Branch85_w7 Density is at H6
      • Other density types also at H6

And Overview TOC also shows same heirarchy that's why

I'm not sure how you're checking it but they are not all at H6 - I'll say to use web inspector in browser dev tools.

The actual problem here is how .. jsonschema:: renders and how rst format allows us to specify nesting in headings - both are leading to same heading levels. It seems to me that jsonschema when rendered, its title (i.e. Specific Structure) takes one next heading level in the section in which it is placed (i.e. Structure with H4) - so it becomes H5. And, the different underline characters in "Densities" as compared to "Structure" makes rst renderer think that Densities is subheading in Structure hence also making it H5.

That's why I said if it is possible to specify that "Densities" is subheading to jsonschema "Specific Structure"?

Copy link
Member

Choose a reason for hiding this comment

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

Since @smithis7 will break down this configuration page into multiple pages as part of his doc restructure project - we can leave it for now. Hence merging - thanks for addressing other 2 comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then I think so the document I linked pertaining to the heading hierarchy in rst is wrong or I may be doing something wrong 🤔

@jaladh-singhal jaladh-singhal merged commit 44765a4 into tardis-sn:master Jun 3, 2021
@DhruvSondhi DhruvSondhi deleted the jsonschema_documentation branch June 3, 2021 19:17
@isaacgsmith isaacgsmith mentioned this pull request Jun 10, 2021
10 tasks
atharva-2001 pushed a commit to atharva-2001/tardis that referenced this pull request Oct 1, 2021
…s-sn#1594)

* Fixing JSON Schema not rendering in the documentation

* Restructuring the configurational abstract

* Moving the documentation part to relevant sections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants