Skip to content

Conversation

misterabdullahAziz
Copy link
Contributor

@misterabdullahAziz misterabdullahAziz commented Oct 7, 2025

📋 Summary

This PR implements a comprehensive Data Highlights app, providing a complete content management system for showcasing research findings and scientific discoveries.

🛠️ Changes Made

  • New Django App: Created pages/highlights app with complete model, views, admin, and templates
  • DataHighlight Model: Comprehensive model with mandatory fields (title, summary, content, featured_image) and optional fields (announcement, tags, figure_caption, topics)
  • Direct Many-to-Many: Implemented direct relationship with topics app (no intermediate model)
  • Search Functionality: Real-time JavaScript search across title, summary, and tags
  • Related Content Algorithm: Jaccard similarity-based content discovery system
  • Admin Interface: Comprehensive admin with organised fieldsets, search, filtering, and bulk actions
  • Markdown Support: Full markdown rendering with syntax highlighting for content
  • Social Sharing: Built-in social media sharing buttons (Twitter, LinkedIn, Facebook)

🔍 Notes for Reviewers

  • Basic styling implemented.

✅ Checklist

  • PR title follows the pattern: FREYA-XXXX: Clear and short description
  • Jira / Github issue is linked in description
  • Assignee is selected
  • Code and content adhere to conventions
  • Automated checks pass
  • Reviewer is selected when the PR is marked as ready for review

🔗 Jira Issue

Closes: FREYA-1549

@misterabdullahAziz misterabdullahAziz self-assigned this Oct 7, 2025
@misterabdullahAziz misterabdullahAziz requested a review from a team as a code owner October 7, 2025 18:37
@Ziip-dev
Copy link
Member

Ziip-dev commented Oct 8, 2025

For future reference, so many changes in a single commit is too much, this doesn't facilitate the review process :)

Copy link
Contributor

@senthil10 senthil10 left a comment

Choose a reason for hiding this comment

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

Requesting changes mostly for required discussions

--color-pp-almost-black: #1a1c1a;
}

/* Custom components for data highlights */
Copy link
Contributor

Choose a reason for hiding this comment

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

We should discuss if we need all these component

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can discuss, maybe app-specific or maybe we can reduce these components once we will have all major apps created.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I mean among the components listed here, I think only topic badges will used in multiple pages/apps. Everything else is mostly specific to highlights (and maybe editorials). In that case I prefer to not have components and just use in-line styling using tailwind.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, I would keep everything inline for now, we are not in the stage where we can really think about how to factor the styles and optimise the utility classes, so let's not bother and keep this for later when things will be more stable :)
For reference: https://tailwindcss.com/docs/styling-with-utility-classes#managing-duplication

{{ topic.name }}
</a>
</span>
{% empty %}
Copy link
Contributor

Choose a reason for hiding this comment

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

do we wanna do it this way or not have "topics" at all if no topics assigned ? I don't have a preference, just making this comment for a discussion.

Copy link
Contributor Author

@misterabdullahAziz misterabdullahAziz Oct 13, 2025

Choose a reason for hiding this comment

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

I implemented it this way because i think it helps editors in content management.
Moreover, it will provide consistency for all highlights.
But if you guys prefer to remove this if no topic assigned, I am okay with that also.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don’t have any preference, I am fine with either. Like I mentioned, made just so we discussed this with the whole team :)

</span>
{% endfor %}
</div>

Copy link
Contributor

Choose a reason for hiding this comment

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

would it be useful to have the "share this" html code in core/templates/share_this.html and use {% include "share_this.html" %} in required pages ?

Just another comment for discussion, we of course have to tweak the code a little if we gonna implement it :)

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 agree with your suggestion. I am just not sure where else we are using these sharing buttons? if we are only using in highlights then maybe keeping it here is more appropriate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I totally agree, currently only highlights and editorial have this I guess. If its gonna be the case with the new portal then maybe it’s not worth abstracting it. We can confirm this with Liane in the discussion 👍

{% for highlight in highlights %}
<div class="data-highlight"
data-search-text="{{ highlight.title|lower }}
{{ highlight.summary|lower }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we should include summary in the search. Since the search is meant for "keywords" search I think all relevant keywords would be covered in title and search tags.

We can discuss it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right that title and topics cover the main keywords.

However, I included summary because researchers often search by methodologies, concepts-focused (e.g., "sequencing", "viral evolution", "phylogenetic analysis") or technical terms that appear in summaries but not titles/topics.
As summary text is not that long, this comprehensive search helps users discover relevant content by research techniques.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but those words will not be in the title or added tags ? that's what I wanna know :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, these words are not in tags, topics, or title. These kinds of words usually goes into abstract or summary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Tags are something added manually in our case and usually they are like what you have mentioned in the example. I am not an expert in this, but discus this with Laine. I am just concerned about random false hits from other regular words. Thats also true for the title, but given the size of the title (compared to summary) it is very minimal.

Might be I am just overthinking, just confirm it with Liane and I am fine with her decision.

# Get active highlights created before this one, ordered by creation date
older_highlights = DataHighlight.objects.filter(
is_active=True,
created_at__lt=self.created_at
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reason not to include newer data highlights than the current one ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a debate either we chose Chronological or Similarity-Based approach.
Its a matter of choice.
I think for single detail highlight, researcher would like to know its progression and background which will be technically old highlights (i tried to looked into current highlights on the portal and realised that this is the same approach of Chronological order implemented).

As newer highlights will always be listed in order on the listing.

Copy link
Contributor

Choose a reason for hiding this comment

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

The current similarity/related is based on the mentioned keywords and not the content or the study itself. In that case I don't how chronological order helps.

For example, if I am an user and I am reading an article on some "X" technology or method, I would be interested on similar articles (i.e. same "X" tech or method) irrespective of whether it is older or newer than the current article I am reading. I would actually be interested in newer similar articles actually 😄

Maybe that's just me, we can discuss this with the team and see what other feel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we can discuss.
I am open for both approaches. I am having current approach as I think current Pathogen portal also showing older highlights only.

return []
return [tag.strip().lower() for tag in self.tags.split(',') if tag.strip()]

def get_related_highlights(self, limit: int = 4, threshold: float = 0.1) -> List['DataHighlight']:
Copy link
Contributor

Choose a reason for hiding this comment

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

Point to discuss, could this be potential re-usable stuff ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. Similar to share buttons only editorials might need similar functionality.
We can discuss.

@misterabdullahAziz misterabdullahAziz force-pushed the FREYA-1549/Abdullah/highlights branch from ddc4ffb to db00e0e Compare October 14, 2025 17:09
<!-- Main Content -->
{% if highlight.content %}
<div class="prose prose-lg max-w-none text-pp-dark-grey mb-8">
{% if highlight.rendered_content %}
Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to ask about this, why have thisif block ? Will there be a scenario where there is no rendered_content ? 🤔

<!-- Announcement (if present) -->
{% if highlight.announcement %}
<div class="announcement">
{% if highlight.rendered_announcement %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here, will there be a scenario where there is no rendered_anouncement ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants