Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion ami/main/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Collaborator

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?

Copy link
Collaborator Author

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:
Screenshot 2024-09-18 at 9 51 26 AM

If top_n=1, then it looks like this:
Screenshot 2024-09-18 at 9 53 02 AM

Note, this is what the test data looks like which modified here.
Screenshot 2024-09-18 at 9 54 42 AM

@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?

Copy link
Collaborator

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).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I understand; where is the test data of the occurrences generated/modified? Based on my testing using the admin, the Top Species chart appears to work -- see my other comment below

)

if top_taxa:
Expand Down
2 changes: 2 additions & 0 deletions ami/main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def summary_data(self):
if self.occurrences.exists():
plots.append(charts.detections_per_hour(project_pk=self.pk))
plots.append(charts.occurrences_accumulated(project_pk=self.pk))
# print(self.pk)
plots.append(charts.event_top_taxa(event_pk=self.pk))
else:
plots.append(charts.events_per_month(project_pk=self.pk))
# plots.append(charts.captures_per_month(project_pk=self.pk))
Expand Down
1 change: 1 addition & 0 deletions ui/src/data-services/models/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface SummaryData {
ticktext?: string[]
}
type: any
orientation: 'h' | 'v'
}

export class Project {
Expand Down
7 changes: 6 additions & 1 deletion ui/src/pages/overview/summary/summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export const Summary = ({ project }: { project: Project }) => (
<PlotGrid>
{project.summaryData.map((summary, index) => (
<Box key={index}>
<Plot title={summary.title} data={summary.data} type={summary.type} />
<Plot
title={summary.title}
data={summary.data}
orientation={summary.orientation}
type={summary.type}
/>
</Box>
))}
</PlotGrid>
Expand Down