Skip to content

Timezone issue described in #593 #595

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

Merged
merged 1 commit into from
Dec 3, 2020
Merged

Timezone issue described in #593 #595

merged 1 commit into from
Dec 3, 2020

Conversation

rumackaaron
Copy link
Contributor

Description

See #593. When we download the CHNG files, the timestamps are automatically converted into the code's timezone, in our case 4pm. We shouldn't run the indicator between 4-6pm Eastern just to be safe.

Changelog

  • run.py

Fixes

Comment on lines +89 to 90
dropdate_dt = (datetime.now() - timedelta(days=1,hours=16))
dropdate_dt = dropdate_dt.replace(hour=0,minute=0,second=0,microsecond=0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you say more about what this does? If they post more than an hour earlier or later, what will happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we run this script at 4:01 and they had posted the files already at 3, then the script will execute properly.

If they consistently post the files late, then I'm pretty sure the code will throw some sort of "File not found" error. It uses dropdate_dt to determine the filenames, so it will expect there to be files from yesterday, but the code can only download files from two days ago.

If CHNG posts the files at 5pm one day and at 4pm the next, and we run the code between 4pm and 5pm, the code will throw an assertion error because it found too many files dropped within the last 24 hours.

This code followed the outline of the HSP download scheme, but maybe a simpler solution is to compute the expected filename beforehand and check if it's been uploaded to their server yet. This way the errors would be more intelligible. For now, if we run the script after 8, everything should work properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

compute the expected filename beforehand

Yep, this sounds ideal going forward. I'll put this PR through as-is and make a tracking issue for the refactor.

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.

CHNG files are dropped to server at 4 Eastern
2 participants