Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Kma 163213435 write import fuel function #1793
This PR gets the fuel values for the current month through the EIA Open Data api
This function will be used to run a regularly scheduled task to keep the fuel prices up to date. There is a CLI command to run this function for now (see setup).
The way this is currently written, we check for missing rows within the last 12 months. This can be adjusted for anything under 12 months.
I'm getting a month's data and choosing the earliest pub_date in that data, assuming that is the first Monday of the month (the record we use). I did write a function to find the first Monday of the month- would it be better to just fetch data for that date?
Add the EIA_KEY to your
Remove the record in
Check the database- the two records you removed from the last 12 months should be there now. The one you removed from more than 12 months ago will not be replaced.
Code Review Verification Steps
@@ Coverage Diff @@ ## master #1793 +/- ## ========================================== + Coverage 49.09% 49.11% +0.02% ========================================== Files 426 427 +1 Lines 18194 18264 +70 Branches 1630 1630 ========================================== + Hits 8932 8971 +39 - Misses 8482 8504 +22 - Partials 780 789 +9
reggieriser left a comment
Nice job working through all this data processing/manipulation! I left some comments -- I think there are a few possible bugs that need fixing, but noted some other style-related items that don't necessarily have to be changed.
I didn't get to review the tests yet, but wanted to go ahead and get this feedback to you.