-
Notifications
You must be signed in to change notification settings - Fork 101
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
Replace feed_expiration_date with rules for 7 and 30 days #1245
Replace feed_expiration_date with rules for 7 and 30 days #1245
Conversation
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.
LGTM! It looks like this branch is out-of-date with master
and I don't have the Update branch
button option. Could you update it so we can merge the PR? Thanks @KClough
40c94f4
to
62a6fbe
Compare
@isabelle-dr just a heads up that I did not split the rules as you proposed in #930 as that seems like it'd only offer additional utility if #1117 was also implemented. |
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.
I've just realized we should update RULES.md
to reflect the changes before merging.
@isabelle-dr just a heads up that I did not split the rules as you proposed in #930 as that seems like it'd only offer additional utility if #1117 was also implemented.
That being said and considering this comment ☝️, I'm also wondering if this notice should be split in two as Isabelle has suggested. From a technical point of view, this PR makes a lot of sense. I think we should just make sure this is the most valuable approach for users.
Specifically, I agree with @gcamp 's comment here, but having one notice for both threshold would make it the only notice to appear as both WARNING
and INFO
in RULES.md
. This is not necessarily a problem, but it could be confusing for users if the difference isn't very well described.
@isabelle-dr, what are your thoughts on this?
I see two options here:
- We keep the code as is and we add the same notice but with a different description under
INFO
inRULES.md
. We would also need to update the current notice description underWARNING
. - We change the code to add a second notice and update
RULES.md
to reflect the changes.
Hello, @KClough, thanks for tackling this issue! I am generally against having two severities for the same notice, for the following two reasons:
I would suggest the code here outputs two rules, maybe IMHO the behavior of this check should be:
|
My message weirdly got posted twice after I edited it, I just deleted one to keep the latest version 😊 |
62a6fbe
to
0060ae0
Compare
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.
@KClough, thanks for updating this PR!
I have made suggestion changes in this PR, mainly:
- Modify the names
FeedExpirationDateNotice30Days
toFeedExpirationDate30DaysNotice
so that they render properly in the validation report (currently it ends-up beingfeed_expiration_date_notice30_days
). I think we will still have a slight problem where they will look likefeed_expiration_date30_days
. - Updates to the documentation so that every rule has all the sections we need.
Additionally, can you please:
3. Rename this PR to "replace feed_expiration_date with rules for 7 and 30 days".
4. Update the table at the top of RULES.md with the new notices.
You can add Jarvus Innovations LL in the copyright section at the top of the files 😊
this.csvRowNumber = csvRowNumber; | ||
this.currentDate = currentDate; | ||
this.feedEndDate = feedEndDate; | ||
this.suggestedExpirationDate = suggestedExpirationDate; |
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.
Do we need to specify a suggested expiration date here? The real suggestion is for as long as the operator is confident that the schedule will continue to be operated, as per the Best Practices.
I see a risk of sending the wrong message, and not much added value.
@bdferris, thoughts?
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.
Maybe we don't need it, but if you look at the original FeedExpirationDateNotice
, the field was already included. If we decide to remove it, maybe it we should open another PR to make the refactor.
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/FeedExpirationDateValidator.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/mobilitydata/gtfsvalidator/validator/FeedExpirationDateValidatorTest.java
Outdated
Show resolved
Hide resolved
@@ -69,7 +70,7 @@ public void feedExpiringInSevenDaysFromNowShouldGenerateNotice() { | |||
validateFeedInfo( | |||
createFeedInfo(GtfsDate.fromLocalDate(TEST_NOW.toLocalDate().plusDays(7))))) | |||
.containsExactly( | |||
new FeedExpirationDateNotice( | |||
new FeedExpirationDateNotice30Days( |
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.
new FeedExpirationDateNotice30Days( | |
new FeedExpirationDate30DaysNotice( |
.../src/test/java/org/mobilitydata/gtfsvalidator/validator/FeedExpirationDateValidatorTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/mobilitydata/gtfsvalidator/validator/FeedExpirationDateValidatorTest.java
Outdated
Show resolved
Hide resolved
@@ -55,7 +56,7 @@ public void validate(GtfsFeedInfo entity, NoticeContainer noticeContainer) { | |||
GtfsDate currentDatePlusThirtyDays = GtfsDate.fromLocalDate(now.plusDays(30)); | |||
if (entity.feedEndDate().isBefore(currentDatePlusSevenDays)) { |
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.
Why is this formula different than the one we have for 30 days?
I have tested a dataset that had feed_end_date
== [today + 7], which should trigger the 7 days notice, but it the 30 days notice was emitted. I think with this formula, what we trigger is a 6 days threshold.
cc @bdferris
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.
@isabelle-dr I believe you're correct, there is a bug with the 7 day calculation. I updated my PR to fix this issue and the related test.
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.
yup, it works now :)
a75d754
to
effaead
Compare
* [General Publishing & General Practices](https://gtfs.org/best-practices/#dataset-publishing--general-practices) | ||
|
||
<details> | ||
#### Notice fields description |
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 table doesn't render, I think we need a line break after "Notice fields description".
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.
Besides my last suggestion (replace 6 days by 7 days) and the rendering of the "Notice fields description" section for the 7 days notice in RULES.md, this PR looks good to me 👍.
@bdferris, do you have the capacity to do the code review for this PR, and do you know what would be the fix so that the notice code doesn't appear as feed_expiration_date7_days,
but appears as feed_expiration_date_7_days
instead?
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.
Aside from the changes requested by @isabelle-dr in RULES.md
, LGTM! Thanks @KClough
c5f8dbd
to
f9badba
Compare
@maximearmstrong I have resolved this feedback, please re-review when you get a chance. Thanks! |
f9badba
to
ca7a730
Compare
Co-authored-by: isabelle-dr <[email protected]>
Co-authored-by: isabelle-dr <[email protected]>
…edExpirationDateValidator.java Co-authored-by: isabelle-dr <[email protected]>
…edExpirationDateValidatorTest.java Co-authored-by: isabelle-dr <[email protected]>
…edExpirationDateValidatorTest.java Co-authored-by: isabelle-dr <[email protected]>
…edExpirationDateValidatorTest.java Co-authored-by: isabelle-dr <[email protected]>
1b2daf2
to
e31f2d6
Compare
LGTM! Thanks Kevin for updating this PR |
Summary:
Summarize the changes in the pull request including how it relates to any issues (include the #number, or link them).
Resolves #930
Expected behavior:
Explain and/or show screenshots for how you expect the pull request to work in your testing (in case other devices exhibit different behavior).
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything