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

NickAkhmetov/CAT-775 - EPIC builders boilerplate, migrate API client #91

Merged
merged 16 commits into from
Jul 22, 2024

Conversation

NickAkhmetov
Copy link
Collaborator

@NickAkhmetov NickAkhmetov commented Jul 18, 2024

This PR:

  • Moves the API client from the portal-ui repo to this repo. This will allow us to deduplicate the visualization generation code from the user-templates-api
  • Adds more test coverage to the client code
  • Sets up the boilerplate for the EPIC builders so we can put together those view configs once there are ingested examples in dev

Copy link
Collaborator

@john-conroy john-conroy left a comment

Choose a reason for hiding this comment

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

Did you introduce a new local code formatter? Should we add it to the repo to avoid future formatter wars?

Comment on lines +72 to +94
self,
groups_token=None,
elasticsearch_endpoint=None,
portal_index_path=None,
ubkg_endpoint=None,
assets_endpoint=None,
soft_assay_endpoint=None,
soft_assay_endpoint_path=None,
entity_api_endpoint=None,
):
self.groups_token = groups_token
self.ubkg_endpoint = ubkg_endpoint
self.assets_endpoint = assets_endpoint
self.entity_api_endpoint = entity_api_endpoint

self._elasticsearch_endpoint = elasticsearch_endpoint
self._portal_index_path = portal_index_path

self._soft_assay_endpoint = soft_assay_endpoint
self._soft_assay_endpoint_path = soft_assay_endpoint_path

self.elasticsearch_url = f"{elasticsearch_endpoint}{portal_index_path}"
self.soft_assay_url = f"{soft_assay_endpoint}/{soft_assay_endpoint_path}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Everything here mostly the same as the client.py in portal-ui outside of passing the configuration values to the constructor?

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, no changes to functionality, just switched the environment variables to instance variables.

headers["Authorization"] = "REDACTED"
return headers

def _request(self, url, body_json=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the next action to create a new lib for the duplicated logic between the portal-ui and here?

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 have a PR up to remove the API client from the portal-ui altogether, relying on the instance from here (i.e. it's how I tested that these changes all work/don't break existing visualizations). Once this PR is merged in and a new release is made, I can finalize that PR; at that point I'll also be able to replace the APIClient in the workspace templates with this one and open a corresponding PR there.

@NickAkhmetov NickAkhmetov changed the title NickAkhmetov/CAT-673 Part 1 - EPIC builders boilerplate, migrate API client NickAkhmetov/CAT-775 - EPIC builders boilerplate, migrate API client Jul 22, 2024
@NickAkhmetov NickAkhmetov merged commit 40c7be6 into main Jul 22, 2024
2 checks passed
@NickAkhmetov NickAkhmetov deleted the nickakhmetov/cat-673-epic-builders branch July 22, 2024 14:24
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