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 user type filter for API and UI users on Users page #229

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anirudhmehra12
Copy link

Pull Request

Description

Please delete the italicised instruction text!
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Yes

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • Yes

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@@ -14,6 +14,7 @@
)

from plots.users import make_api_requests_plot, make_api_frequency_requests_plot
from nowcasting_datamodel.connection import DatabaseConnection
Copy link
Contributor

Choose a reason for hiding this comment

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

im not sure we need this

# If no URL, make a basic guess based on email (this is a fallback)
# You might want to replace this with a more robust method
is_ui = email.lower().endswith('@example.com') # Replace with actual UI user identifier
return (user_type == "UI" and is_ui) or (user_type == "API" and not is_ui)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was hoping the options could go into the _get_all_last_api_request_func function below. Then we souldnt have to do any filtering afterwards

Copy link
Contributor

@peterdudfield peterdudfield Dec 1, 2024

Choose a reason for hiding this comment

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

This function is get_all_last_api_request or get_all_last_api_request_sites and I think with the latest versions of nowcatsing_datamodel or pv_site_datamodel they can take in variables of include_in_url and exclude_in_url, see https://github.com/openclimatefix/pv-site-datamodel/blob/main/pvsite_datamodel/read/user.py#L106

Copy link
Author

Choose a reason for hiding this comment

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

sure, I will make the changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

thank you

Copy link
Author

Choose a reason for hiding this comment

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

I have made changes

Copy link
Contributor

Choose a reason for hiding this comment

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

did you push the changes?

Copy link
Author

Choose a reason for hiding this comment

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

yes

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I can see them in this PR?

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