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

Modify model directory documentation UI and related pages #3203

Open
wants to merge 45 commits into
base: master
Choose a base branch
from

Conversation

jessica-mitchell
Copy link
Contributor

@jessica-mitchell jessica-mitchell commented May 2, 2024

This PR modifies the model directory page and how it functions as well as related pages with significant changes. There is now a interactive UI that dynamically loads results of button selection using Javascript.

See Read the Docs output here: https://nest-simulator--3203.org.readthedocs.build/en/3203/models/index.html

The script that extracted the model user docs and built the indices is now split into 2 scripts.
The extract_userdocs_cpp.py only extracts the documentation from the C++ header files and creates the restructured text pages for each model.
The model_tag_setup.py extracts the tags for each model and creates dictionaries, {model: [tags]} and [{tag: "tag", models: ["models"], count: # of models}]. These dictionaries are used in Jinja templates as well as a JSON file is created to be used by Javascript that will render the output client-side.

The models/index page now has a 'model selector' that displays each tag, in order of number of models that have that tag (with exception of neuron, synapse and device being the first tags) as multi-select buttons.
By clicking on one or more buttons the corresponding models will be displayed.

In addition to the model selector there is also a dropdown that lists in alphabetical order (grouped by neuron, synapse, and device) all models.

Some information from 'models-main' is moved into here. The page also has links to pages for more info on neurons, synapses and devices - these pages will require more work in the future but each of those pages also lists all corresponding models.

When working on this, I found that the pre-commit hook for clang would fail, so changes to it were also done, and fixes #3182

Some tags were fixed up, and "artificial" was added as a tag (one reason was to check that the script worked as expected when modifying the source)

@jessica-mitchell jessica-mitchell added T: Enhancement New functionality, model or documentation S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels May 2, 2024
@jessica-mitchell jessica-mitchell added this to In progress in Documentation via automation May 2, 2024
if not os.path.exists(outdir):
log.info("creating output directory " + outdir)
os.mkdir(outdir)
userdoc_re = re.compile(r"BeginUserDocs:?\s*(?P<tags>([\w -]+(,\s*)?)*)\n+(?P<doc>(.|\n)*)EndUserDocs")

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'BeginUserDocs' and containing many repetitions of ' '.

file_paths = glob.glob(os.path.join(directory_path, "*.h"))

userdoc_re = re.compile(r"BeginUserDocs:?\s*(?P<tags>([\w -]+(,\s*)?)*)\n+(?P<doc>(.|\n)*)EndUserDocs")

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with 'BeginUserDocs' and containing many repetitions of ' '.
@clinssen clinssen self-requested a review May 2, 2024 11:12
@clinssen
Copy link
Contributor

clinssen commented May 2, 2024

Thanks for this! Could you post a link to the rendered RtD page for this PR?

@@ -29,7 +29,7 @@
namespace nest
{

/* BeginUserDocs: neuron, binary
/* BeginUserDocs: neuron, binary, artificial
Copy link
Contributor

Choose a reason for hiding this comment

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

What makes a neuron "artificial"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was explained to me that binary neurons are artificial, but maybe I misinterpreted @ddahmen can you comment?

@jessica-mitchell
Copy link
Contributor Author

Thanks for this! Could you post a link to the rendered RtD page for this PR?

I just did, see top comment (you were just too fast :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation
Projects
Documentation
  
In progress
Development

Successfully merging this pull request may close these issues.

Clang-format does not support JavaScript error
2 participants