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

Feature/site events #2

Merged
merged 20 commits into from
Aug 18, 2020
Merged

Feature/site events #2

merged 20 commits into from
Aug 18, 2020

Conversation

timbeccue
Copy link
Collaborator

@timbeccue timbeccue commented Aug 12, 2020

Story: https://www.pivotaltracker.com/story/show/173955139

This pull request adds an additional endpoint that returns notable day/night events over a 24 hour period at an observatory. For example: sunset/twilight/calibration frame acquisition times.

A number of files have small changes because I moved all the python code into the top level api directory as (I recently learned) is standard in python applications.

The bulk of the work happens in api/events.py. This is the code that calculates the events of interest. It is a rewrite of the original file from ptr-observatory (here: https://github.com/LCOGT/ptr-observatory/blob/dev/ptr_events.py) using the skyfield package instead of ephem, per Wayne's request.

Unit tests are included in api/tests/test_events.py. This is my first serious attempt at unit tests so some things may look weird, but I hope it's mostly straightforward.

The serverless.yaml file includes the new api definition, which runs a function in api/events_handler.py which assembles the events dictionary to return. It also includes http error handling.

Finally, the readme has been updated to document the new endpoint. I've also deployed a test version of these additions to verify that it all works as intended.

note to future self: more frequent logical commits (with descriptive titles) makes pull requests easier to parse.

@timbeccue timbeccue marked this pull request as ready for review August 12, 2020 19:10
.gitignore Outdated Show resolved Hide resolved
api/events.py Outdated Show resolved Hide resolved
api/events.py Outdated Show resolved Hide resolved
api/events.py Outdated Show resolved Hide resolved
@wrosing
Copy link

wrosing commented Aug 12, 2020 via email

@mgdaily
Copy link
Contributor

mgdaily commented Aug 12, 2020

@wrosing @timbeccue Just searching around, I found this utility to perform pep8 checks. We use this in an automated fashion to check every commit made to BANZAI using TravisCI.

https://pycodestyle.pycqa.org/en/latest/

@cmccully
Copy link

@wrosing and @timbeccue I noticed that there a lot of committed .pyc files. You should probably remove those and add them to your .gitignore.

api/events.py Outdated Show resolved Hide resolved
api/events.py Outdated Show resolved Hide resolved
api/events.py Outdated Show resolved Hide resolved
api/events_handler.py Outdated Show resolved Hide resolved
api/events_handler.py Outdated Show resolved Hide resolved
api/helpers.py Outdated Show resolved Hide resolved
api/legacy_events.py Outdated Show resolved Hide resolved
api/legacy_events.py Outdated Show resolved Hide resolved
api/legacy_events.py Outdated Show resolved Hide resolved
api/legacy_events.py Outdated Show resolved Hide resolved
@mgdaily mgdaily self-requested a review August 17, 2020 16:14
Copy link
Contributor

@mgdaily mgdaily left a comment

Choose a reason for hiding this comment

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

Approved, since my comments were addressed

@timbeccue timbeccue requested a review from cmccully August 17, 2020 22:40
@timbeccue timbeccue merged commit 6e46480 into master Aug 18, 2020
@timbeccue timbeccue deleted the feature/site-events branch May 3, 2021 19:41
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