-
Notifications
You must be signed in to change notification settings - Fork 1
Adding PATH cutouts to F4PZ #41
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
base: master
Are you sure you want to change the base?
Conversation
profxj
left a comment
There was a problem hiding this 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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
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.
| print("browse_url:", browse_url) # will appear in server logs/stdout | |
| log.info(f"browse_url: {browse_url}") # replaced print with logging |
| blob = None | ||
| if data.get("encoding") == "base64" and data.get("content"): | ||
| try: | ||
| cleaned = "".join(str(data["content"]).splitlines()) |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
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.
| cleaned = "".join(str(data["content"]).splitlines()) | |
| cleaned = "".join(data["content"].splitlines()) |
| cleaned = "".join(str(data["content"]).splitlines()) | ||
| blob = base64.b64decode(cleaned) |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
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.
| .path-cutout-img { max-width: 320px; height: auto; } | ||
| .path-fallback { display:none; width:320px; height:320px; line-height:320px; text-align:center; margin:0; } |
Copilot
AI
Oct 17, 2025
There was a problem hiding this comment.
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.
| .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; } |
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!