Skip to content

Conversation

@tarraneh
Copy link
Collaborator

Adding HTML + code to query PATH cutouts from the chime-path repo. Note that this does require setting the GITHUB access token in the .env!

@tarraneh tarraneh assigned tarraneh, profxj and lordrick94 and unassigned tarraneh Oct 17, 2025
Copy link

@profxj profxj left a comment

Choose a reason for hiding this comment

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

color me super impressed!

just a couple of doc string comments from me


log = logging.getLogger(__name__)

def path_cutout_proxy(request, frb_name: str) -> HttpResponse:
Copy link

Choose a reason for hiding this comment

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

please add brief comments on the inputs

Copy link

Choose a reason for hiding this comment

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

and what is returned

return resp


def path_cutout_zoomin_proxy(request, frb_name: str) -> HttpResponse:
Copy link

Choose a reason for hiding this comment

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

same as above: inputs and outputs

@profxj profxj requested review from Copilot and lordrick94 October 17, 2025 19:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds functionality to display PATH cutout images for FRB transients by proxying image requests from the private chime-path GitHub repository. The implementation requires a GITHUB_TOKEN environment variable for authentication.

Key Changes:

  • Added two new proxy view functions to fetch PATH cutout images (standard and zoom-in) from the GitHub API
  • Integrated the cutout images into the FRB transient detail page UI
  • Configured the Docker environment to accept a GitHub token

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
settings.py Added blank line at end of file
docker/docker-compose.yml Added GITHUB_TOKEN environment variable configuration
YSE_App/views.py Implemented two proxy functions for fetching PATH cutouts from GitHub API and added browse URL generation in transient detail view
YSE_App/urls.py Added URL patterns for the two new proxy endpoints
YSE_App/templates/YSE_App/frb_transient_detail.html Restructured layout to display PATH cutout images alongside existing footprint carousel and external links

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

f"chime_path/{year}/{transient_obj.name}"
)

print("browse_url:", browse_url) # will appear in server logs/stdout
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

Debug print statement should be removed or replaced with proper logging using the log object already defined at line 950.

Suggested change
print("browse_url:", browse_url) # will appear in server logs/stdout
log.info(f"browse_url: {browse_url}") # replaced print with logging

Copilot uses AI. Check for mistakes.
blob = None
if data.get("encoding") == "base64" and data.get("content"):
try:
cleaned = "".join(str(data["content"]).splitlines())
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The str() cast is unnecessary if data['content'] is already a string. Consider removing it or add a comment explaining when this would be a non-string type.

Suggested change
cleaned = "".join(str(data["content"]).splitlines())
cleaned = "".join(data["content"].splitlines())

Copilot uses AI. Check for mistakes.
Comment on lines +1114 to +1115
cleaned = "".join(str(data["content"]).splitlines())
blob = base64.b64decode(cleaned)
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

This duplicates the exact same base64 decoding logic from lines 1006-1007. Consider extracting this into a helper function to reduce code duplication.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +32
.path-cutout-img { max-width: 320px; height: auto; }
.path-fallback { display:none; width:320px; height:320px; line-height:320px; text-align:center; margin:0; }
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The hardcoded dimensions (320px) create a magic number that's repeated multiple times. Consider using a CSS variable or moving this to a shared stylesheet.

Suggested change
.path-cutout-img { max-width: 320px; height: auto; }
.path-fallback { display:none; width:320px; height:320px; line-height:320px; text-align:center; margin:0; }
:root { --cutout-size: 320px; }
.path-cutout-img { max-width: var(--cutout-size); height: auto; }
.path-fallback { display:none; width:var(--cutout-size); height:var(--cutout-size); line-height:var(--cutout-size); text-align:center; margin:0; }

Copilot uses AI. Check for mistakes.
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