-
Notifications
You must be signed in to change notification settings - Fork 1
Created helper, endpoint, templates, tests for biomedical concept categories #23
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6ab1fca
Created helper, endpoint, templates, tests for biomedical concept cat…
pendingintent 3e922a9
Update tests/test_concept_categories.py
pendingintent 444693b
perform deterministic single encoding
pendingintent 2742704
Merge branch 'add-concept-categories' of https://github.com/pendingin…
pendingintent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| {% extends 'base.html' %} | ||
| {% block content %} | ||
| <h2>Biomedical Concept Categories (<span id="conceptTotal">{{ count }}</span>)</h2> | ||
| <p> | ||
| This list is derived from the CDISC Library API. Each link points to the | ||
| category's API resource (which lists biomedical concepts in that category). | ||
| </p> | ||
| <div style="margin:0.5em 0 1em;"> | ||
| <label for="categorySearch"><strong>Search:</strong></label> | ||
| <input id="categorySearch" type="text" placeholder="Filter categories..." style="width:280px;" oninput="filterCategories()" /> | ||
| <span id="searchCount" style="margin-left:1em;color:#555;"></span> | ||
| </div> | ||
|
|
||
| {% if rows %} | ||
| <table border="1" cellspacing="0" cellpadding="4" id="categoriesTable"> | ||
| <thead> | ||
| <tr> | ||
| <th style="text-align:left;">Name</th> | ||
| <th style="text-align:left;">Title</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {% for r in rows %} | ||
| <tr> | ||
| <td> | ||
| {% if r.name %} | ||
| <!-- Pass raw name; backend will encode once to avoid double-encoding --> | ||
| <a href="/ui/concept_categories/view?name={{ r.name }}">{{ r.name }}</a> | ||
| {% else %} | ||
| <em>n/a</em> | ||
| {% endif %} | ||
| </td> | ||
| <td>{{ r.title }}</td> | ||
| </tr> | ||
| {% endfor %} | ||
| </tbody> | ||
| </table> | ||
|
|
||
| <script> | ||
| function filterCategories(){ | ||
| const q = document.getElementById('categorySearch').value.toLowerCase(); | ||
| const rows = document.querySelectorAll('#categoriesTable tbody tr'); | ||
| let visible = 0; | ||
| rows.forEach(tr => { | ||
| const text = tr.innerText.toLowerCase(); | ||
| if(!q || text.indexOf(q) !== -1){ | ||
| tr.style.display = ''; | ||
| visible++; | ||
| } else { | ||
| tr.style.display = 'none'; | ||
| } | ||
| }); | ||
| const sc = document.getElementById('searchCount'); | ||
| if(q){ | ||
| sc.textContent = visible + ' match' + (visible === 1 ? '' : 'es'); | ||
| } else { | ||
| sc.textContent = ''; | ||
| } | ||
| } | ||
| </script> | ||
| {% else %} | ||
| <p><em>No biomedical concept categories available (empty list).</em></p> | ||
| {% endif %} | ||
|
|
||
| <p><a href="/">Return Home</a></p> | ||
| {% endblock %} | ||
32 changes: 32 additions & 0 deletions
32
src/soa_builder/web/templates/concept_category_detail.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| {% extends 'base.html' %} | ||
| {% block content %} | ||
| <h2>Biomedical Concepts in Category: {{ category }}</h2> | ||
| <p>Total concepts: <strong>{{ count }}</strong></p> | ||
|
|
||
| {% if rows %} | ||
| <table border="1" cellspacing="0" cellpadding="4" id="conceptsTable"> | ||
| <thead> | ||
| <tr> | ||
| <th style="text-align:left;">Title</th> | ||
| <th style="text-align:center;">Biomedical Concept Code</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {% for r in rows %} | ||
| <tr> | ||
| <td>{{ r.title }}</td> | ||
| <td style="text-align:center;"> | ||
| {% if r.code %} | ||
| <a href="/ui/concepts/{{ r.code }}">{{ r.code }}</a> | ||
| {% else %}<em>n/a</em>{% endif %} | ||
| </td> | ||
| </tr> | ||
| {% endfor %} | ||
| </tbody> | ||
| </table> | ||
| {% else %} | ||
| <p><em>No concepts found for this category.</em></p> | ||
| {% endif %} | ||
|
|
||
| <p><a href="/ui/concept_categories">← Back to Categories</a></p> | ||
| {% endblock %} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The category name is inserted directly into the URL without HTML encoding. Use Jinja's
| urlencodefilter to properly encode the name parameter:href=\"/ui/concept_categories/view?name={{ r.name | urlencode }}\"