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

NickAkhmetov/CAT-1111, CAT-965, CAT-1148 Organ Page Fixes #3692

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG-organ-page-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Ensure ovary and fallopian tube organ pages are properly populated with left/right laterality datasets.
- Ensure urinary bladder organ page includes Bladder datasets.
- Ensure bladder organ icon displays appropriately.
- Ensure cell population plot controls drawer does not overlap the app bar.
4 changes: 3 additions & 1 deletion context/app/organ/fallopian-tube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ description: Initial section of the oviduct through which the ova pass from the
to the uterus.
icon: https://cdn.jsdelivr.net/gh/cns-iu/md-icons@main/other-icons/organs/ico-organs-fallopian-tube-left.svg
has_iu_component: true
search: []
search:
- Fallopian Tube (Left)
- Fallopian Tube (Right)
4 changes: 3 additions & 1 deletion context/app/organ/ovary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ asctb: ovary-v1.2
description: The gonad of a female organism which contains germ cells.
icon: https://cdn.jsdelivr.net/gh/cns-iu/md-icons@main/other-icons/organs/ico-organs-ovaries.svg
has_iu_component: true
search: []
search:
- Ovary (Left)
- Ovary (Right)
3 changes: 2 additions & 1 deletion context/app/organ/urinary-bladder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ description: Distensible musculomembranous organ situated in the anterior part o
the pelvic cavity in which urine collects before excretion[MP].
icon: https://cdn.jsdelivr.net/gh/cns-iu/md-icons@main/other-icons/organs/ico-organs-bladder.svg
has_iu_component: true
search: []
search:
- Bladder
8 changes: 5 additions & 3 deletions context/app/routes_file_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import frontmatter

from .utils import get_default_flask_data, make_blueprint, get_organs
from .utils import get_default_flask_data, get_organ_name_mapping, make_blueprint, get_organs


blueprint = make_blueprint(__name__)
Expand Down Expand Up @@ -80,13 +80,15 @@ def organ_details_view(name):
@blueprint.route('/organ/<name>.json')
def get_organ_details(name):
organs = get_organs()
organ_names = get_organ_name_mapping()
# Remove all spaces, underscores, and any text in parentheses
normalized_name = name.lower().strip()
normalized_name = normalized_name.split('(')[0].strip().replace(
' ', '-').replace('_', '-')
if normalized_name not in organs:
safe_organ_name = organ_names.get(normalized_name)
if safe_organ_name not in organs:
return {}
filename = Path(dirname(__file__)) / 'organ' / f'{secure_filename(normalized_name)}.yaml'
filename = Path(dirname(__file__)) / 'organ' / f'{secure_filename(safe_organ_name)}.yaml'
organ = safe_load(filename.read_text())
return organ

Expand Down
13 changes: 13 additions & 0 deletions context/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ def get_organs():
return organs


def get_organ_name_mapping():
organs = get_organs()
organ_file_names = {k: k for k, _ in organs.items()}
# Add search field for each organ as additional keys
for k, v in organs.items():
search = v['search']
if len(search) > 0:
for s in search:
organ_file_names[s.lower()] = k
print(organ_file_names)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this print statement need to be here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does not, left over from troubleshooting :) Thanks for catching it!

return organ_file_names


# Redirect to primary dataset if this entity is
# - non-existent
# - a support entity (e.g. an image pyramid)
Expand Down
8 changes: 4 additions & 4 deletions context/package-lock.json

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

2 changes: 1 addition & 1 deletion context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@visx/text": "^3.3.0",
"@visx/tooltip": "^3.3.0",
"@xyflow/react": "^12.0.3",
"cellpop": "^0.0.12",
"cellpop": "^0.0.13",
"chart.js": "^4.4.2",
"d3": "^7.9.0",
"d3-array": "^3.2.4",
Expand Down
Loading