-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add top species chart to overview page #580
base: main
Are you sure you want to change the base?
Conversation
vanessavmac
commented
Sep 17, 2024
- Add the top species chart to the project overview
- Flip the chart so the top species count is on top rather than the bottom
✅ Deploy Preview for ami-dev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for ami-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…o 387-add-top-species-chart-to-overview-page
ami/main/charts.py
Outdated
@@ -269,7 +269,7 @@ def event_top_taxa(event_pk: int, top_n: int = 10): | |||
.values("name") | |||
# .annotate(num_detections=models.Count("occurrences__detections")) | |||
.annotate(num_detections=models.Count("occurrences")) | |||
.order_by("-num_detections")[:top_n] | |||
.order_by("num_detections")[:top_n] |
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.
Isn't this lowest to highest?
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.
Yes, you're right. I just tested out the chart by modifying the species count and made the corrected changes. Here's an example top species chart:
If top_n=1, then it looks like this:
Note, this is what the test data looks like which modified here.
@mihow Is the plot showing the correct data? I thought that the plot would show 2 occurrences of Vanessa atalanta and 1 occurrence of Vanessa itea?
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.
Thanks Vanessa,
The TEST_TAXA_CSV_DATA
is for Taxon entries, not Occurrence entries. So adding duplicates there won't have the effect you are looking for.
The charts are showing which occurrences have been IDed to which Taxa. In the test data, you want to modify the number of occurrences that are generated for each taxon, rather than the taxonomy choices, if that makes sense?
Also if you make your self "is_staff" in the Django admin, then you can modify the occurrence IDs pretty quickly without regenerating. But I like both approaches (the test data should have different numbers of IDs for different species).
@vanessavmac I'm not seeing the top species chart on the Project overview page. Did it get lost in a merge? |
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.
I am not seeing the top species chart in the project overview page, at least in the deploy preview.