hackgvl / trolley-tracker-api-dot-net Goto Github PK
View Code? Open in Web Editor NEWAPI for tracking Greenville's trolleys with .NET
License: MIT License
API for tracking Greenville's trolleys with .NET
License: MIT License
Add field to trolley definition for suggested trolley icon color in the app. Formatted as HTML #RRGGBB
Clicking on the Log out link does not logout an authenticated user
@reds This is the repo that you are looking for
Rather than collecting stop locations by entering numbers, make an interface to edit, add, or remove stops via a map interface.
Optionally, also update those corresponding stop locations in FourSquare.
Add 2 fields to both trolley and runningTrolley records:
Capacity - Integer total number of passengers the trolley can carry
PassengerLoad - floating point number, 0..1 , where 1 = 100% of capacity
This information will be derived from the Syncromatics API after the switchover.
The stops map tiles no longer display due to Mapquest dropping service. Switch to Mapbox tiles via limited developer key.
Microsoft doesn't support Basic Authentication out of the box, so it was manually added in the App_Start folder. The passwords were embedded in the software. What is the proper way to assign basic auth credentials so that they don't appear in the public Repo? Is there a better way to authenticate our web app?
There are frequent route deviations when one or more blocks are closed for an event. It is useful to have the capability to create derived routes based on standard routes, and schedule them for the duration of the event. The ideal solution is a Javascript-based vector editor to allow the client to edit route travel paths directly and easily. Should minimize mouse clicks and edit time to modify a route.
Creating multiple special schedule events during one fixed schedule results in multiple routes showing.
I was downtown and saw one trolley running and show up, and the second which I also saw physically did not show up in app. We also got feedback that it wasn’t running.
Not sure if this was user error or system
The RouteSchedules API returns an error at the endpoint {"Message":"No HTTP resource was found that matches the request URI 'http://api.yeahthattrolley.com/api/v1/RouteSchedules'.","MessageDetail":"No action was found on the controller 'RouteSchedules' that matches the request."}
Match trolleys to route based on percentage of route stops seen. These may change at runtime, in which case the trolley color will be updated to the new matching route in the database.
I noticed inside of TrolleyTracker/Controllers/UTCToLocalTime.cs on line 14, the time zone is set as "Eastern Standard Time." I'm not sure if this has caused any issues in the project, but it would give incorrect results while we're in daylight savings time. However, you should be able to use "Eastern Time" to cover both standard and daylight savings. Either way, great work on the project!
We've re-branded the GitHub organization to hackgvl as part of making Code For Greenville inactive to satisfy the Code For America trademark transition.
Shall we read-only archive any, or all, of the older Trolley Tracker repos?
@bikeoid @ajhodges @jeremywight and whoever else we think to ask.
@MarkMcDaniels , great work on the route formatting! Please check the result on the Dev Server where I have 4 simulated routes to match what will be running this summer. http://yeahthattrolley.azurewebsites.net/ClientWeb
Also, I noticed that the route schedule appears immediately - previously it came up only upon request or if there was nothing running.
I also moved the HTML formatting out of the code and into the web page where it belongs. It should make future tuning much easier!
Wanted to post an issue since I didn't see one here. Via GitHub
Known moderate severity security vulnerability detected in Bootstrap.Less >= 3.0.0, < 3.4.1 defined in packages.config.
packages.config update suggested: Bootstrap.Less ~> 3.4.1.
The application used the Web Authorization - with a local DB. This is normally best for web sites where users sign themselves up for membership. I couldn't find how to set up a role that that could be used with the local DB so that edits could be assigned to a role.
Host web client in a folder which could be converted to an FTP site to allow it to be maintained separately. Transfer existing functionality from the trolley-tracker-web repo.
Add support for trolley and route colors
Add support for highlighting active route when trolley is clicked
Add support to display arrival time when stop is clicked.
Remove the capacity labels, as currently they are not accurate (for multiple reasons), so we want to remove this when you tap the trolley. We should add the route name to the label when a user taps on the route.
When a trolley is off route, the trolley will be assigned a black route color. We should add a label for this off route/undefined value to "Detour Route" so the user understands it might not follow an expected pathway.
When you select the 'Schedule' link, currently all routes are showing as black, and should be showing the proper colors so that a user has understanding and can plan ahead.
It would simplify some of the front-end logic if we return the IconColorRGB in the 'Running' endpoint. That way I don't have to download the entire list of trolleys and loop through them to find the color of the running trolleys!
Port code to use DotNetCore. This would be a major rewrite, but would allow more hosting flexibility in the future.
Create sample Javascript that parses the JSON returned by API calls. Display database contents on a single page, with live or current items in green, and inactive items in either gray or hidden.
Use Leaflet to display information on a map.
Add link to sample static web page named DB Visualizer. http://yeahthattrolley.azurewebsites.net/
I have a couple of recommendations for you.
I’ve got two user reports last night and tonight that the Trolleys aren’t tracking. They don’t se to be working for me either. New API issue? @bikeoid
There are frequent route changes for special events. While the schedule can be edited up to 1 week in advance, the original schedule must be restored or updated for the following week's special schedule. This is error-prone.
Add the concept of 'schedule overrides' by date so that service can be cancelled, a specific route can be changed or added by event date without needing to change the fixed schedule which only rarely changes.
Retain compatibility with existing route schedule API clients by sending the resultant schedule for the upcoming 7 days. The order of days of the week might possibly change to begin with the current day.
It looks like one of the Trolley colors doesn't match any Route color.
The Trolley in question shows as green on the map, and has ID 1, Number 6, IconColorRGB cfdf01.
It appears to be running the "Top of Main" route, RouteColorRGB acb71d (which is also green, but a different green).
I don't remember if I ever sent you the colors I was using in the app initially, but I think I had changed the green a bit (from the Greenlink color) to make it stand out more on the map. Possibly one of the colors is the official color, and one is the altered value I used?
Add route color to each schedule entry to facilitate display of colors with schedule.
I don’t think this is an API issue, but reporting just in case. Got an email from a user and checked and am also seeing the same behavior:
I have some feedback to provide about the TrolleyTracker app:
None of your trolley tracking is updating. It shows two trolleys way off the route in the middle of nothing, and the other has been in the same place for 3 hours.
Trolleys are now running dual beacons for location tracking. Greenlink has requested that we obtain beacon information from their API so that they can eliminate the second cellular data plan from each trolley.
Syncromatics RTPI API documentation is at https://syncromatics.docs.apiary.io/# .
Automatically purge old log entries when viewing logs to prevent growing logs forever
Record last beacon time for each trolley for debug purposes. Return only with the detailed trolley record, not in the "Active Running" API call.
Not all menu items should be shown to all user roles - remove those items not applicable. For example a user not yet logged in or having a role for editing would not see any Edit or Delete options and only the System Admin should see the role manager.
Tasks to complete the MVP of Route Calculations as discussed at the Meetup:
The goal is to create a basic MVP of giving a user the ability to have an estimation of how long it will be for a trolley to get to their selected stop on a given route. There are obviously more improvements which could be made, but this is the basic MVP implementation to give a user some insight into timing.
The completion of these tasks would allow the client apps to be provided the timing on a given route, and then they would be responsible for determining what the route is that the client needs the data for and when to make the request to the server to get this data. Again, going for the MVP here :)
Assumptions:
We are working under the assumption that in the near future we're going to have a defined route, given by the trolley operator upon start, which we will pull an ID for.
Tasks:
() Match the trolley route based on id and assigned to a color (that's already defined here
() Determine the location of the trolley and it's direction of travel
() Match the location of the trolley on the route path
() Determine the timing between stops for all stops in a single loop (partially completed in this file
() Return that list of stop id's with the route id and the calculated time of arrival to each stop on that route loop
Add route name sort clause so that multiple route names at the same time will always be in a defined order.
Mike,
We were talking about eventually having the option for the Trolley Tracker to utilize public map layers.
I wondered if it would be possible to publish a read-only GeoJSON version of the trolley stops and we could include it in the available map layers.
The near term vision is to put these map layers behind something like Cloudflare caching to make them super scalable. That should allow us to syndicate fresh data and avoid putting non-app load on origin servers.
Thoughts?
There are an excessive number of SQL queries, even with in the same page. For example, to render the /Trolleys page generates 10 queries of the sequence
exec sp_executesql N'SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[Email] AS [Email],
[Extent1].[EmailConfirmed] AS [EmailConfirmed],
[Extent1].[PasswordHash] AS [PasswordHash],
[Extent1].[SecurityStamp] AS [SecurityStamp],
[Extent1].[PhoneNumber] AS [PhoneNumber],
[Extent1].[PhoneNumberConfirmed] AS [PhoneNumberConfirmed],
[Extent1].[TwoFactorEnabled] AS [TwoFactorEnabled],
[Extent1].[LockoutEndDateUtc] AS [LockoutEndDateUtc],
[Extent1].[LockoutEnabled] AS [LockoutEnabled],
[Extent1].[AccessFailedCount] AS [AccessFailedCount],
[Extent1].[UserName] AS [UserName]
FROM [dbo].[AspNetUsers] AS [Extent1]
WHERE [Extent1].[Id] = @p__linq__0',N'@p__linq__0 nvarchar(4000)',@p__linq__0=N'ccea5518-acc1-403d-8b4c-c9b4fafe49d2'
exec sp_executesql N'SELECT
[Extent1].[Id] AS [Id],
[Extent1].[UserId] AS [UserId],
[Extent1].[ClaimType] AS [ClaimType],
[Extent1].[ClaimValue] AS [ClaimValue]
FROM [dbo].[AspNetUserClaims] AS [Extent1]
WHERE [Extent1].[UserId] = @p__linq__0',N'@p__linq__0 nvarchar(4000)',@p__linq__0=N'ccea5518-acc1-403d-8b4c-c9b4fafe49d2'
exec sp_executesql N'SELECT
[Extent1].[LoginProvider] AS [LoginProvider],
[Extent1].[ProviderKey] AS [ProviderKey],
[Extent1].[UserId] AS [UserId]
FROM [dbo].[AspNetUserLogins] AS [Extent1]
WHERE [Extent1].[UserId] = @p__linq__0',N'@p__linq__0 nvarchar(4000)',@p__linq__0=N'ccea5518-acc1-403d-8b4c-c9b4fafe49d2'
exec sp_executesql N'SELECT
[Extent1].[UserId] AS [UserId],
[Extent1].[RoleId] AS [RoleId]
FROM [dbo].[AspNetUserRoles] AS [Extent1]
WHERE [Extent1].[UserId] = @p__linq__0',N'@p__linq__0 nvarchar(4000)',@p__linq__0=N'ccea5518-acc1-403d-8b4c-c9b4fafe49d2'
Change all database context usages to 'using' pattern to ensure that the connection can be closed by the framework in every case. Otherwise if the database connection pool fills and gets stuck, it is difficult to prove that there is a server problem since there can be several reasons for an Entity Framework query not to automatically close (exceptions, a break statement, etc)
Hey @bikeoid! Did we ever get anywhere with Leaflet.js on snapping to roads for allowing GreenLink to update the Routes? Was brought up tonight cc @dacohenii
Add an option to create route variation based on the original route color.
Also add link for KML upload when creating a new route definition since that will be the next step 90% of the time.
Hodges and I are going to Greenlink tomorrow morning to update the apps to server info and such. Are we on the production server for the API? Mostly, I'm asking if we change the app info to the current server we're not going to have to go back to Greenlink again to change server info are we?
Design a system to collect the reported trolley location data in a way that it can be analyzed to predict travel times, and eventually arrival times at any particular user's stop.
Update Dot Net App Leaflet Library to 1.0 and make any necessary changes for the Leaflet API
For the KML file upload form, Chrome (and only Chrome) disregards the submit() behavior in certain cases.
Make WebAPI return JSON by default when viewed in a browser since this is supported by most tools. Will still support XML with explicit text/xml request
Add logging, primarily to create an audit trail of who-modified-what-when. Secondarily, add exception handling and logging at key locations to improve diagnostics. Consider using the nlog framework.
@bikeoid Just wanted to give a heads up. On Sat we caught the trolley at Falls Park and it was only about .5mi away and the iOS app estimated time to stop said 25min, I knew that wouldn't be accurate so I timed it. Trolley 00 took 11min to arrive. Just wanted to give a heads up. I'm not sure if we are using this from the Greenlink system, or if this is our calculation, but I would say that at that far off it is more of a deterrent than a help, as if I didn't know it wasn't going to take that long I probably would have walked instead of waiting.
Thoughts?
A user came in tonight and shared an idea which I think would be a great addition. She is new to town and found the app and was trying to plan a trip using the app. Since there isn't a schedule she wondered how she would plan ahead. I mentioned that the trolley loop typically takes somewhere between 45-60min, but I realize that is not something you would know.
She mentioned it would be really helpful to give some idea of how long the full loop takes so that you can plan accordingly. I was thinking it might be good to time the full loop length and then put that on the route when you select it. I realize that each loop will be different, so maybe we average the last 3 loops, but generally, I think that could be a great thing to share, or at least just make a general hardcoded label the loops typically take around an hour. Thoughts @bikeoid @austin9350 @ajhodges ?
Make trolley location updates event driven by WebSockets / SignalR or equivalent technology.
Add colors to route definition so they can match the official Greenlink map colors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.