Skip to content
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

Feature/pdct 451 add summary endpoint #17

Merged
merged 11 commits into from
Oct 9, 2023

Conversation

katybaulch
Copy link
Contributor

Description

  • Replaced dummy response with analytics summary data using count queries on the document, family, and collection services.
  • "n_events" is currently set to 0 as we have not implemented events in the admin backend yet (see here. When we implement events in the admin backend, we should update how "n_events" is calculated.

Link to Linear ticket PDCT-451

Type of change

Please select the option(s) below that are most relevant:

  • Bug fix
  • [x ] New feature
  • Breaking change

How Has This Been Tested?

Tested locally. Actual tests to come.

Reviewer Checklist

  • The PR represents a single feature (small driveby fixes are also ok)
  • The PR includes tests that are sufficient for the level of risk
  • The code is sufficiently commented, particularly in hard-to-understand areas
  • Any required documentation updates have been made
  • Any TODOs added are captured in future tickets
  • No FIXMEs remain

@katybaulch katybaulch requested a review from diversemix October 4, 2023 17:14
@linear
Copy link

linear bot commented Oct 4, 2023

PDCT-451 Add summaries Endpoint

Return the count for DFCE - see peter - put this on GET /api/v1/analytics/summary

Response spec:

{
  n_documents: int,
  n_families: int,
  n_collections: int,
  n_events: int,
}

Suggested Approach

"Thin slices" … I suggest two PRs, this would be good to do - to form the habit of small slices of value:

  • First PR will add the endpoint returning a dummy response (same schema as above) - this will/could allow Patrick to start to use it for frontend development.
  • Second PR will add a "analytics" service with a summary() to query all the repos for their count - I suggest adding count() to all the repos - also add tests

@diversemix
Copy link
Contributor

Amazing! This is exactly how it should be done 👍 😺

@katybaulch katybaulch marked this pull request as ready for review October 9, 2023 11:20
app/service/analytics.py Outdated Show resolved Hide resolved
Copy link
Contributor

@diversemix diversemix left a comment

Choose a reason for hiding this comment

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

Excellent once again! 🍨

@katybaulch katybaulch merged commit d380204 into main Oct 9, 2023
2 checks passed
@katybaulch katybaulch deleted the feature/PDCT-451-add-summary-endpoint branch October 9, 2023 16:30
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.

2 participants