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

feat: 1534 service window in summary report #1837

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

qcdyx
Copy link
Contributor

@qcdyx qcdyx commented Sep 10, 2024

Summary:
Closes #1534

Expected behavior:
GTFS Validator report should show Service Date Range under Feed Info section.

  1. When only calendar_dates.txt is used
    test dataset:
    poa_gtfs.zip
    )
    image

  2. When only calendar_dates.txt is used
    test dataset:
    Google_transit.zip
    image

  3. When both calendars.txt and calendar_dates.txt are used
    test dataset:
    Archive.zip
    image

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

@qcdyx qcdyx linked an issue Sep 10, 2024 that may be closed by this pull request
Copy link
Contributor

📝 Acceptance Test Report

📋 Summary

✅ The rule acceptance has passed for commit 039dbfa
Download the full acceptance test report here (report will disappear after 90 days).

📊 Notices Comparison

New Errors (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Errors (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

New Warnings (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Warnings (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

🛡️ Corruption Check

7 out of 1575 sources (~0 %) are corrupted.
Dataset Ref Report Exists Ref Report Readable Latest Report Exists Latest Report Readable
ca-ontario-guelph-transit-gtfs-1300 N/A N/A
pl-mazowieckie-komunikacja-miejska-plock-gtfs-1150 N/A N/A
pl-podkarpackie-komunikacja-miejska-krosno-gtfs-1002 N/A N/A
pl-podkarpackie-komunikacja-miejska-przemysl-gtfs-1000 N/A N/A
th-chiang-mai-northern-chiang-mai-gtfs-1282 N/A N/A
us-michigan-mass-transportation-authority-flint-gtfs-926 N/A N/A
us-utah-utah-transit-authority-uta-gtfs-170 N/A N/A

⏱️ Performance Assessment

📈 Validation Time

Assess the performance in terms of seconds taken for the validation process.

Time Metric Dataset ID Reference (s) Latest (s) Difference (s)
Average -- 3.93 4.01 ⬆️+0.08
Median -- 1.37 1.43 ⬆️+0.06
Standard Deviation -- 11.66 11.89 ⬆️+0.24
Minimum in References Reports ph-unknown-hm-transport-inc-and-robinsons-malls-gtfs-1105 0.51 0.61 ⬆️+0.10
Maximum in Reference Reports gb-unknown-uk-aggregate-feed-gtfs-2014 349.53 358.83 ⬆️+9.30
Minimum in Latest Reports us-florida-citrus-county-transit-gtfs-630 0.53 0.56 ⬆️+0.03
Maximum in Latest Reports gb-unknown-uk-aggregate-feed-gtfs-2014 349.53 358.83 ⬆️+9.30

Copy link
Contributor

📝 Acceptance Test Report

📋 Summary

✅ The rule acceptance has passed for commit a12fcf6
Download the full acceptance test report here (report will disappear after 90 days).

📊 Notices Comparison

New Errors (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Errors (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

New Warnings (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Warnings (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

🛡️ Corruption Check

7 out of 1575 sources (~0 %) are corrupted.
Dataset Ref Report Exists Ref Report Readable Latest Report Exists Latest Report Readable
ca-ontario-guelph-transit-gtfs-1300 N/A N/A
es-valencia-emt-valencia-gtfs-795 N/A N/A
pl-mazowieckie-komunikacja-miejska-plock-gtfs-1150 N/A N/A
pl-podkarpackie-komunikacja-miejska-krosno-gtfs-1002 N/A N/A
pl-podkarpackie-komunikacja-miejska-przemysl-gtfs-1000 N/A N/A
th-chiang-mai-northern-chiang-mai-gtfs-1282 N/A N/A
us-michigan-mass-transportation-authority-flint-gtfs-926 N/A N/A

⏱️ Performance Assessment

📈 Validation Time

Assess the performance in terms of seconds taken for the validation process.

Time Metric Dataset ID Reference (s) Latest (s) Difference (s)
Average -- 4.08 4.23 ⬆️+0.15
Median -- 1.40 1.47 ⬆️+0.07
Standard Deviation -- 12.82 12.74 ⬇️-0.08
Minimum in References Reports ph-unknown-hm-transport-inc-and-robinsons-malls-gtfs-1105 0.50 0.69 ⬆️+0.19
Maximum in Reference Reports gb-unknown-uk-aggregate-feed-gtfs-2014 293.01 290.27 ⬇️-2.74
Minimum in Latest Reports ar-buenos-aires-subterraneos-de-buenos-aires-subte-gtfs-6 0.62 0.54 ⬇️-0.07
Maximum in Latest Reports gb-unknown-uk-aggregate-feed-gtfs-2014 293.01 290.27 ⬇️-2.74

GtfsTableContainer<GtfsTrip> tripContainer,
GtfsTableContainer<GtfsCalendar> calendarTable,
GtfsTableContainer<GtfsCalendarDate> calendarDateTable) {
List<GtfsTrip> trips = tripContainer.getEntities();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure tripContainer cannot be null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://gtfs.org/documentation/schedule/reference/#tripstxt, trips.txt is required, so I assumed it's non null, isn't it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, if trips.txt is absent it will give a error notice, but do we have a guarantee that the code here will not be reached in that case? If it is, we'll get an NPE which in general is not good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, it could be empty. I'll add the logic.

Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

Copy link
Contributor

This contribution does not follow the conventions set by the Google Java style guide. Please run the following command line at the root of the project to fix formatting errors: ./gradlew goJF.

LocalDate startDate = calendar.startDate().getLocalDate();
LocalDate endDate = calendar.endDate().getLocalDate();

if (startDate != null || endDate != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these be null or will they be some default (e.g. 1970-01-01) if the date is not in the file?

Copy link
Contributor Author

@qcdyx qcdyx Sep 13, 2024

Choose a reason for hiding this comment

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

you are right, they can be unix time 1970-01-01, in that case, we should just display N/A

String serviceId = trip.serviceId();
for (GtfsCalendarDate calendarDate : calendarDates) {
if (calendarDate.serviceId().equals(serviceId)) {
LocalDate date = calendarDate.date().getLocalDate();
Copy link
Contributor

@jcpitre jcpitre Sep 12, 2024

Choose a reason for hiding this comment

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

Maybe you should check if the exception_type is addition before using it in the calculation, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When only calendar_dates.txt is used, can we assume that the exception_type is always 1? @emmambd

Copy link
Contributor

📝 Acceptance Test Report

📋 Summary

✅ The rule acceptance has passed for commit ce2a0f1
Download the full acceptance test report here (report will disappear after 90 days).

📊 Notices Comparison

New Errors (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Errors (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

New Warnings (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Warnings (0 out of 1568 datasets, ~0%) ✅

No changes were detected due to the code change.

🛡️ Corruption Check

7 out of 1575 sources (~0 %) are corrupted.
Dataset Ref Report Exists Ref Report Readable Latest Report Exists Latest Report Readable
ca-ontario-guelph-transit-gtfs-1300 N/A N/A
es-valencia-emt-valencia-gtfs-795 N/A N/A
pl-mazowieckie-komunikacja-miejska-plock-gtfs-1150 N/A N/A
pl-podkarpackie-komunikacja-miejska-krosno-gtfs-1002 N/A N/A
pl-podkarpackie-komunikacja-miejska-przemysl-gtfs-1000 N/A N/A
th-chiang-mai-northern-chiang-mai-gtfs-1282 N/A N/A
us-michigan-mass-transportation-authority-flint-gtfs-926 N/A N/A

⏱️ Performance Assessment

📈 Validation Time

Assess the performance in terms of seconds taken for the validation process.

Time Metric Dataset ID Reference (s) Latest (s) Difference (s)
Average -- 3.88 3.97 ⬆️+0.09
Median -- 1.39 1.45 ⬆️+0.06
Standard Deviation -- 10.59 10.67 ⬆️+0.08
Minimum in References Reports ph-unknown-hm-transport-inc-and-robinsons-malls-gtfs-1105 0.50 0.52 ⬆️+0.02
Maximum in Reference Reports gb-unknown-uk-aggregate-feed-gtfs-2014 288.78 288.66 ⬇️-0.11
Minimum in Latest Reports ar-buenos-aires-subterraneos-de-buenos-aires-subte-gtfs-6 0.53 0.52 ⬇️-0.01
Maximum in Latest Reports gb-unknown-uk-aggregate-feed-gtfs-2014 288.78 288.66 ⬇️-0.11

@qcdyx qcdyx marked this pull request as draft September 13, 2024 14:15
}
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM d, yyyy");
if ((earliestStartDate == null) && (latestEndDate == null)
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this generate an NPE if earliestStartDate is null and latestEndDate is not null?

List<GtfsCalendar> calendars = calendarTable.getEntities();
for (GtfsTrip trip : trips) {
String serviceId = trip.serviceId();
for (GtfsCalendar calendar : calendars) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't this loop be replaced by something like this:
GtfsCalendar calendar = ((GtfsCalendarTableContainer) calendarTable).byServiceId(serviceId);

List<GtfsCalendarDate> calendarDates = calendarDateTable.getEntities();
for (GtfsTrip trip : trips) {
String serviceId = trip.serviceId();
for (GtfsCalendarDate calendarDate : calendarDates) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't this loop be replaced by something like this:
GtfsCalendarDate calendarDate = ((GtfsCalendarDateTableContainer) calendarDateTable).byServiceId(serviceId);

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.

feat: Include service window in Summary report
2 participants