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

Add Total ConnectID Accounts Metric #497

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pxwxnvermx
Copy link
Contributor

@pxwxnvermx pxwxnvermx commented Feb 18, 2025

Product Description

This PR adds the Total ConnectID Accounts metric to the report.

Technical Summary

Ticket Link
Related ConnectID API PR

Safety Assurance

Safety story

Automated test coverage

QA Plan

Labels & Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@pxwxnvermx pxwxnvermx self-assigned this Feb 18, 2025
@pxwxnvermx pxwxnvermx marked this pull request as ready for review February 18, 2025 18:29
@@ -70,6 +70,12 @@ def filter_users(country_code: str, credential: list[str]):
return [ConnectIdUser(**user_dict) for user_dict in data["found_users"]]


def fetch_user_counts() -> dict[str, int]:
Copy link
Member

@sravfeyn sravfeyn Feb 21, 2025

Choose a reason for hiding this comment

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

We should cache this in a way we only fetch current month data from API (since previous months data change, so it can be cached more aggressively)

Copy link
Member

Choose a reason for hiding this comment

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

Also, it doesn't seem very ideal to fetch this data from CID, is there no way to infer it on CCC?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is not a way to infer it on CCC, but I agree we should cache it. Honestly, we could just save it in postgres. We only need to fetch the current month (and maybe the last one if we haven't fetched since the month switched). We might even be able to do that nightly on a task so loading the table never causes a network call.

@@ -78,6 +80,7 @@ def get_table_data_for_year_month(
date_paid__lt=end_date,
)

connectid_user_count_data = fetch_user_counts()
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem ideal that we are fetching all months data but we need only the selected month data, so may be pass a month param to the API?

Copy link
Collaborator

@calellowitz calellowitz left a comment

Choose a reason for hiding this comment

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

Beyond the fetch comment, I think this metric isn't quite right. It should be cumulative to that point (the total number created through that month, not in that month). I don't have strong opinions whether to do that on the connect id side or here, but I believe that is the requirement.

@@ -70,6 +70,12 @@ def filter_users(country_code: str, credential: list[str]):
return [ConnectIdUser(**user_dict) for user_dict in data["found_users"]]


def fetch_user_counts() -> dict[str, int]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is not a way to infer it on CCC, but I agree we should cache it. Honestly, we could just save it in postgres. We only need to fetch the current month (and maybe the last one if we haven't fetched since the month switched). We might even be able to do that nightly on a task so loading the table never causes a network call.

Copy link
Collaborator

@calellowitz calellowitz left a comment

Choose a reason for hiding this comment

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

This looks fine, but I do think long run we will want to save this in postgres. Since past data wont change over time, its silly to refetch it on page view

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.

4 participants