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: Initial support for validation app GUI #1146

Merged
merged 13 commits into from
May 19, 2022

Conversation

bdferris-v2
Copy link
Collaborator

Provides initial implementation for the simple GUI to be used with the packaged validation app. Details of the UI product requirements and proposed implementation are documented in https://bit.ly/gtfs-validator-packaged-exe

Screen Shot 2022-05-13 at 1 42 35 PM
.

@CLAassistant
Copy link

CLAassistant commented May 13, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ bdferris-v2
✅ barbeau
❌ bdferris
You have signed the CLA already but the status is still pending? Let us recheck it.

@bdferris-v2 bdferris-v2 linked an issue May 13, 2022 that may be closed by this pull request
@bdferris-v2
Copy link
Collaborator Author

cc @barbeau in case you have thoughts

@maximearmstrong maximearmstrong added this to In Review in The Tech Dashboard (archived) via automation May 16, 2022
@isabelle-dr
Copy link
Contributor

@bdferris thanks for working on this initial GUI!
Do you have a screenshot of what the interface looks like under the "Advanced" button?

@bdferris-v2
Copy link
Collaborator Author

@isabelle-dr

Screen Shot 2022-05-16 at 2 11 48 PM

Copy link
Contributor

@maximearmstrong maximearmstrong left a comment

Choose a reason for hiding this comment

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

I haven't reviewed everything yet, but here are my first comments.

Copy link
Member

@barbeau barbeau left a comment

Choose a reason for hiding this comment

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

When I run this on Windows 10 Home with JDK 11, I see the UI and can click on "Choose local file" to select a GTFS file, but when I click on "Validate" I get this error:

image

May 17, 2022 10:35:01 AM org.mobilitydata.gtfsvalidator.app.gui.Main main
INFO: gtfs-validator: start
May 17, 2022 10:35:01 AM org.mobilitydata.gtfsvalidator.app.gui.Main main
INFO: gtfs-validator: exit
May 17, 2022 10:36:19 AM org.mobilitydata.gtfsvalidator.runner.ValidationRunner run
INFO: validation config:
ValidationRunnerConfig{gtfsSource=file:///C:/git-projects/gtfs-validator/tma-tn-us.zip, outputDirectory=C:\Users\sjbar\GtfsValidator, storageDirectory=Optional.empty, validationReportFileName=report.json, systemErrorsReportFileName=system_errors.json, numThreads=1, countryCode=ZZ, prettyJson=true}
May 17, 2022 10:36:19 AM org.mobilitydata.gtfsvalidator.runner.ValidationRunner run
INFO: validators:
Single-entity validators
	GtfsFrequency: GtfsFrequencyEndRangeValidator 
	GtfsCalendar: GtfsCalendarEndRangeValidator 
	GtfsShape: GtfsShapeLatLonValidator 
	GtfsStopTime: GtfsStopTimeEndRangeValidator 
	GtfsAttribution: AttributionWithoutRoleValidator 
	GtfsFeedInfo: FeedExpirationDateValidator FeedServiceDateValidator GtfsFeedInfoEndRangeValidator 
	GtfsStop: GtfsStopLatLonValidator LocationTypeSingleEntityValidator StopNameValidator 
	GtfsPathway: PathwayLoopValidator 
	GtfsRoute: RouteColorContrastValidator RouteNameValidator 
Single-file validators
	GtfsStopTableContainer: ParentLocationTypeValidator 
	GtfsShapeTableContainer: ShapeIncreasingDistanceValidator 
	GtfsFareRuleTableContainer: DuplicateFareRuleZoneIdFieldsValidator 
	GtfsFrequencyTableContainer: OverlappingFrequencyValidator 
	GtfsRouteTableContainer: DuplicateRouteNameValidator 
	GtfsAgencyTableContainer: AgencyConsistencyValidator 
	GtfsStopTimeTableContainer: MissingTripEdgeValidator StopTimeArrivalAndDepartureTimeValidator StopTimeIncreasingDistanceValidator TimepointTimeValidator 
Multi-file validators
	BlockTripsWithOverlappingStopTimesValidator GtfsAttributionAgencyIdForeignKeyValidator GtfsAttributionRouteIdForeignKeyValidator GtfsAttributionTripIdForeignKeyValidator GtfsFareAttributeAgencyIdForeignKeyValidator GtfsFareRuleContainsIdForeignKeyValidator GtfsFareRuleDestinationIdForeignKeyValidator GtfsFareRuleFareIdForeignKeyValidator GtfsFareRuleOriginIdForeignKeyValidator GtfsFareRuleRouteIdForeignKeyValidator GtfsFrequencyTripIdForeignKeyValidator GtfsPathwayFromStopIdForeignKeyValidator GtfsPathwayToStopIdForeignKeyValidator GtfsRouteAgencyIdForeignKeyValidator GtfsStopLevelIdForeignKeyValidator GtfsStopParentStationForeignKeyValidator GtfsStopTimeStopIdForeignKeyValidator GtfsStopTimeTripIdForeignKeyValidator GtfsTransferFromStopIdForeignKeyValidator GtfsTransferToStopIdForeignKeyValidator GtfsTripRouteIdForeignKeyValidator GtfsTripServiceIdForeignKeyValidator GtfsTripShapeIdForeignKeyValidator LocationHasStopTimesValidator MatchingFeedAndAgencyLangValidator MissingCalendarAndCalendarDateValidator MissingLevelIdValidator PathwayDanglingGenericNodeValidator PathwayEndpointTypeValidator PathwayReachableLocationValidator ShapeToStopMatchingValidator ShapeUsageValidator StopTimeTravelSpeedValidator StopZoneIdValidator TranslationFieldAndReferenceValidator TripAgencyIdValidator TripUsabilityValidator TripUsageValidator UrlConsistencyValidator 

May 17, 2022 10:36:19 AM org.mobilitydata.gtfsvalidator.app.gui.ValidationDisplay handleError
SEVERE: Error running validation
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/git-projects/gtfs-validator/tma-tn-us.zip
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at org.mobilitydata.gtfsvalidator.runner.ValidationRunner.createGtfsInput(ValidationRunner.java:227)
	at org.mobilitydata.gtfsvalidator.runner.ValidationRunner.run(ValidationRunner.java:80)
	at org.mobilitydata.gtfsvalidator.app.gui.MonitoredValidationRunner.lambda$run$0(MonitoredValidationRunner.java:39)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

@barbeau
Copy link
Member

barbeau commented May 17, 2022

This same error actually happens with CLI validation as well, with parameters -i tma-tn-us.zip -o output -c us:

Multi-file validators
	BlockTripsWithOverlappingStopTimesValidator GtfsAttributionAgencyIdForeignKeyValidator GtfsAttributionRouteIdForeignKeyValidator GtfsAttributionTripIdForeignKeyValidator GtfsFareAttributeAgencyIdForeignKeyValidator GtfsFareRuleContainsIdForeignKeyValidator GtfsFareRuleDestinationIdForeignKeyValidator GtfsFareRuleFareIdForeignKeyValidator GtfsFareRuleOriginIdForeignKeyValidator GtfsFareRuleRouteIdForeignKeyValidator GtfsFrequencyTripIdForeignKeyValidator GtfsPathwayFromStopIdForeignKeyValidator GtfsPathwayToStopIdForeignKeyValidator GtfsRouteAgencyIdForeignKeyValidator GtfsStopLevelIdForeignKeyValidator GtfsStopParentStationForeignKeyValidator GtfsStopTimeStopIdForeignKeyValidator GtfsStopTimeTripIdForeignKeyValidator GtfsTransferFromStopIdForeignKeyValidator GtfsTransferToStopIdForeignKeyValidator GtfsTripRouteIdForeignKeyValidator GtfsTripServiceIdForeignKeyValidator GtfsTripShapeIdForeignKeyValidator LocationHasStopTimesValidator MatchingFeedAndAgencyLangValidator MissingCalendarAndCalendarDateValidator MissingLevelIdValidator PathwayDanglingGenericNodeValidator PathwayEndpointTypeValidator PathwayReachableLocationValidator ShapeToStopMatchingValidator ShapeUsageValidator StopTimeTravelSpeedValidator StopZoneIdValidator TranslationFieldAndReferenceValidator TripAgencyIdValidator TripUsabilityValidator TripUsageValidator UrlConsistencyValidator 

May 17, 2022 12:11:30 PM org.mobilitydata.gtfsvalidator.cli.Main main
SEVERE: Error running validation
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /C:/git-projects/gtfs-validator/tma-tn-us.zip
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.base/java.nio.file.Path.of(Path.java:147)
	at java.base/java.nio.file.Paths.get(Paths.java:69)
	at org.mobilitydata.gtfsvalidator.runner.ValidationRunner.createGtfsInput(ValidationRunner.java:227)
	at org.mobilitydata.gtfsvalidator.runner.ValidationRunner.run(ValidationRunner.java:80)
	at org.mobilitydata.gtfsvalidator.cli.Main.main(Main.java:45)


Execution failed for task ':main:Main.main()'.
> Process 'command 'C:/Program Files/Java/jdk-11.0.12/bin/java.exe'' finished with non-zero exit value -1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

We should probably add additional unit tests to check path parsing on Windows, or set up one of the end-to-end CI tests to run on Windows as well (or maybe both).

@barbeau
Copy link
Member

barbeau commented May 17, 2022

Here's what the raw text looks like in the GTFS input text box after selecting the file:

C:\git-projects\gtfs-validator\tma-tn-us.zip

Copy link
Contributor

@maximearmstrong maximearmstrong left a comment

Choose a reason for hiding this comment

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

I've reviewed everything now. This is a great PR, thank you @bdferris-v2! A few more comments before approval.

Also, I tested the app on Mac OS and it worked perfectly for both the local ZIP file and the URL.

package org.mobilitydata.gtfsvalidator.app.gui;

import com.google.common.flogger.FluentLogger;
import java.awt.*;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
import java.awt.*;
import java.awt.Desktop;

Copy link
Member

@barbeau barbeau May 17, 2022

Choose a reason for hiding this comment

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

@bdferris-v2 There is a IntelliJ Google Java Format style file linked in this section which should keep you from fighting the IDE:
https://github.com/google/google-java-format#intellij-android-studio-and-other-jetbrains-ides

It's strange that the CI task to check code format doesn't catch import wildcards. 🤷

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm actually already using that plugin, but it doesn't seem to affect imports. I went and tweaked my Intellij imports settings and it seems to be working better now.

Copy link
Member

Choose a reason for hiding this comment

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

For imports I believe you need to set the style using https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml - the plugin alone won't do it.

Copy link
Contributor

@isabelle-dr isabelle-dr left a comment

Choose a reason for hiding this comment

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

In the HTML output, the parameter definition is slightly more descriptive, so most users wouldn't need to go to the USAGE.md file to understand them.
In the "Advanced section", could we have matching descriptions? I added them in line.

Also: are we going to add the other parameters as discussed in the design document? (validation report name, systems errors report name, HTML report name, and export notice schema?)

@bdferris-v2
Copy link
Collaborator Author

Sean, I believe the validation exception you are seeing on Windows is fixed with ed9c7a3. I was able to repro the issue myself.

@bdferris-v2
Copy link
Collaborator Author

@isabelle-dr I made the text changes to the existing fields. For the other proposed advanced options, I have the following thoughts:

  1. I'm wondering if we really need to add filename overrides? I'm skeptical how much usage they'd get for users of the app, where usage is more ad-hoc (as opposed to the command-line app where a user might want more explicit output control for integration into a pipeline or something).
  2. I'd like to punt on the export-schema option as well, at least for this PR. Mostly to keep this PR from getting even bigger.

@barbeau
Copy link
Member

barbeau commented May 18, 2022

Sean, I believe the validation exception you are seeing on Windows is fixed with ed9c7a3. I was able to repro the issue myself.

Thanks @bdferris-v2! Confirmed, it's fixed now on my machine. I tested with a directory with spaces as well and that works too.

Not sure it's related to this PR, but I'm noticing that in the HTML report the input and output paths aren't formatted the same way:

image

@barbeau barbeau mentioned this pull request May 18, 2022
4 tasks
@barbeau
Copy link
Member

barbeau commented May 18, 2022

I opened PR #1155 to add a CI end-to-end check on Windows as well.

@barbeau
Copy link
Member

barbeau commented May 18, 2022

Whoops, sorry, I didn't mean to merge master branch into this PR (hit the button on the wrong tab). But I guess it needed to happen anyway...

@isabelle-dr
Copy link
Contributor

@bdferris-v2 Re: the advanced parameters.
I'm OK with your two points above.

Additionally, the users that would export the notice schema for parsing would probably use the validator with the command line where they have access to this parameter. Thanks for updating the descriptions.

@maximearmstrong
Copy link
Contributor

Not sure it's related to this PR, but I'm noticing that in the HTML report the input and output paths aren't formatted the same way:

image

Oh, right. This is because the GTFS Input is a URI and the output directory is a Path. I missed it because it's formatted the same way on MacOS. @isabelle-dr What are your thoughts on this? If you think we should fix it, maybe we should open an issue about it, because it is not related to this PR.

Copy link
Contributor

@maximearmstrong maximearmstrong left a comment

Choose a reason for hiding this comment

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

Other than this, I think we are ready to merge. Thank you @bdferris-v2 !

The Tech Dashboard (archived) automation moved this from In Review to Approved May 19, 2022
@bdferris-v2
Copy link
Collaborator Author

Cool. I can commit to a fast-follow to address the path display issue on Windows. Thanks!

@bdferris-v2 bdferris-v2 merged commit aadf4bb into MobilityData:master May 19, 2022
The Tech Dashboard (archived) automation moved this from Approved to Done May 19, 2022
@bdferris-v2 bdferris-v2 deleted the issue/1134/app_gui branch May 19, 2022 23:30
@bdferris-v2
Copy link
Collaborator Author

Apologies @maximearmstrong I missed that import issue. Let me fix that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add a simple GUI to the desktop validation app in :app:gui
6 participants