Skip to content

Conversation

acwhite211
Copy link
Member

@acwhite211 acwhite211 commented Sep 12, 2025

Fixes #7414

Creates a stats_counts api that returns in a json response the counts for collection objects, collections, and specify users. Also, edit the call to the stats server, with these new parameters added. The stats count values are cached for 24 hours in order to not over request to the database.

The lambda function for handling the new stats request is here https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions/AggrgatedSp7Stats?tab=aliases. I also put the lambda function code on discourse https://discourse.specifysoftware.org/t/aggregated-stats-data-lambda-function/3028

The corresponding issue for the stats server to use these new fields is here specify/sp7-stats#7

TODO: Decide what other fields want to be added.

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add pr to documentation list

Testing instructions

  • Open up the specify home page.
  • Look in the dev tools network tab. Check that in the request to the stats contains the new stats counts fields.
  • Look in the dev tools network tab. See that the request to the new stats endpoint was successful.
image

@acwhite211 acwhite211 added this to the 7.12.0 milestone Sep 12, 2025
@acwhite211 acwhite211 self-assigned this Sep 12, 2025
@github-project-automation github-project-automation bot moved this to 📋Back Log in General Tester Board Sep 12, 2025
@acwhite211
Copy link
Member Author

Working on fixing the Response body is not available to scripts (Reason: CORS Missing Allow Origin) issue that happens on the test panel.

@acwhite211
Copy link
Member Author

Ok, the CORS Missing Allow Origin issue is resolved on the test panel. Should get a good response now.

Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

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

  • Look in the dev tools network tab. Check that in the request to the stats contains the new stats counts fields.
  • Look in the dev tools network tab. See that the request to the new stats endpoint was successful.

Looks good!

@emenslin emenslin requested a review from a team October 15, 2025 20:33
@acwhite211 acwhite211 modified the milestones: 7.12.0, 7.11.3 Oct 17, 2025
@Iwantexpresso Iwantexpresso self-requested a review October 20, 2025 15:50
Copy link

@Iwantexpresso Iwantexpresso left a comment

Choose a reason for hiding this comment

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

  • Look in the dev tools network tab. Check that in the request to the stats contains the new stats counts fields.

  • Look in the dev tools network tab. See that the request to the new stats endpoint was successful.

@Iwantexpresso
Copy link

Iwantexpresso commented Oct 20, 2025

Found a different issue that sometimes causes an 500 server error to sometimes appear instead of 200. Otherwise, whenever the Get request Responds properly the expected fields and values are there


image

OS: MacOS 26.0.1
Web browser: Firefox
Database: geo_swiss_2025_09_09
Username: spadmin

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

Labels

None yet

Projects

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

Create new stats lambda function and context api for counts needed by the stats server

4 participants