Skip to content

Commit

Permalink
#3090 removed hyperlinks and displaying cooccurring/uncertain in MVL …
Browse files Browse the repository at this point in the history
…export.
  • Loading branch information
Bharath-kandula committed Sep 25, 2023
1 parent ac6c259 commit e4f553c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
10 changes: 8 additions & 2 deletions classification/models/classification_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,25 @@ def __lt__(self, other):
def conditions(self) -> List[ConditionResolved]:
all_terms = set()
all_plain_texts = set()
all_joins = set()
for cm in self.modifications:
c = cm.classification
if resolved := c.condition_resolution_obj:
for term in resolved.terms:
all_terms.add(term)
all_joins.add(resolved.join)
else:
if text := cm.get(SpecialEKeys.CONDITION):
all_plain_texts.add(text)
all_condition_resolved = []
shared_join = None
if len(all_joins) == 1: # if there's more than one join, we can't display it
shared_join = all_joins.pop()

for term in all_terms:
all_condition_resolved.append(ConditionResolved(terms=[term], join=None))
all_condition_resolved.append(ConditionResolved(terms=[term], join=shared_join))
for plain_text in all_plain_texts:
all_condition_resolved.append(ConditionResolved(terms=[], join=None, plain_text=plain_text))
all_condition_resolved.append(ConditionResolved(terms=[], join=shared_join, plain_text=plain_text))

all_condition_resolved.sort()
return all_condition_resolved
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load classification_tags %}
<br/>
{% spaceless %}
<table style="max-width:1200px">
<thead>
<tr style='border-bottom:1px solid gray;border-top:1px solid gray'>
Expand All @@ -22,11 +23,16 @@
<del>{{ group.clinical_significance | ekey:'clinical_significance' }}</del><br/>{{ group.clinical_significance_pending | ekey:'clinical_significance' }} (PENDING)
{% else %}{{ group.clinical_significance | ekey:'clinical_significance' }}{% endif %}
</td>
<td style='padding:8px'>{% for condition in group.conditions %}<div>{% condition condition_obj=condition limit=None %}</div>{% empty %}-{% endfor %}</td>
<td style='padding:8px'>{% for condition in group.conditions %}<div>{% condition condition_obj=condition limit=None no_links=True %}</div>{% empty %}-{% endfor %}
{% if group.conditions|length > 0 and group.conditions.0.join_text %}
<span class="font-italic">{{ group.conditions.0.join_text }}</span>
{% endif %}
</td>
<td style='padding:8px'>{{ group.zygosities | ekey:'zygosity' }}</td>
<td style='font-family:monospace;padding:8px'>{% for acmg in group.acmg_criteria %}{% if not forloop.first %}, {% endif %}{{ acmg }}{% empty %}-{% endfor %}</td>
<td style='font-family:monospace;padding:8px'><div style='white-space: nowrap'>{% with curated_date=group.most_recent_curated %}{% if curated_date.name %}{{ curated_date.name }} {% endif %}{{ curated_date.date | date:'Y-m-d' }}{% endwith %}</div></td>
</tr>
{% endfor %}
</tbody>
</table>
</table>
{% endspaceless %}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
{% empty %}
<div class="no-value">-</div>
{% endfor %}
{% if group.conditions|length > 0 and group.conditions.0.join_text %}
<span class="font-italic">{{ group.conditions.0.join_text }}</span>
{% endif %}
</td>
<td style="width:100px;">
{% if show_allele_origin %}
Expand Down
7 changes: 5 additions & 2 deletions classification/templates/classification/tags/condition.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
{% if condition.terms %}
{% for term in condition.terms %}
{% if not forloop.first %}<br/>{% endif %}
<span><a href="{% url 'ontology_term' term.url_safe_id %}" class="hover-link">{{ term.id }}</a> {{ term.name }}</span>
{% if no_links %}
<span> {{ term.id }} {{ term.name }}</span>
{% else %}
<span><a href="{% url 'ontology_term' term.url_safe_id %}" class="hover-link">{{ term.id }}</a> {{ term.name }}</span>
{% endif %}
{% endfor %}
{% if condition.join_text %}&#32;<span class="font-italic">{{ condition.join_text }}</span>{% endif %}
{% else %}{{ condition.plain_text | limit_length:limit }}{% endif %}
4 changes: 2 additions & 2 deletions classification/templatetags/classification_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ def db_ref(data: VCDbRefDict, css: Optional[str] = ''):


@register.inclusion_tag("classification/tags/condition.html")
def condition(condition_obj: ConditionResolved, limit: Optional[int] = 100):
return {"condition": condition_obj, "limit": limit}
def condition(condition_obj: ConditionResolved, limit: Optional[int] = 100, no_links: Optional[bool] = None):
return {"condition": condition_obj, "limit": limit, "no_links": no_links}


# look at removing this
Expand Down

0 comments on commit e4f553c

Please sign in to comment.