Gravwell Blog

Tracking BART Trains with Gravwell

Written by John Floren | May 5, 2022 12:00:00 PM

We publish a lot of networking-focused information on this blog, but Gravwell is really a very flexible tool for analyzing any sort of data. To demonstrate this, we occasionally go out looking for interesting public APIs and build a demo around them. In this case, I'm going to use Gravwell Flows to fetch data from the Bay Area Rapid Transit (BART) public API and build a few dashboards around it!

Polling the API

The BART agency is kind enough to provide a free API key for anyone to use as long as you pinky-swear to play nice. With that in hand, it was trivial to build a flow that hits several API endpoints every minute:



The flow consists of four HTTP nodes, each performing a GET request on a different API endpoint. The response comes back as a JSON blob, which is perfect for passing directly into the Ingest node:



Once the flow is in operation, it's simply a matter of querying the data and extracting interesting components, such as the number of trains currently in service:





Building Dashboards

With BART data flowing into the system, the next obvious step is to build some dashboards around it. The status dashboard shows general system status and a list of stations:



I also built an investigative dashboard for a single station and an actionable to trigger it when text is selected. I can select a station from the station list:



Clicking "Check departures" takes me straight to the appropriate dashboard for that station, where I can see that the Concord station has a train leaving toward SFO in 4 minutes:



Conclusion

Gravwell is not just for network data! You can use it to analyze just about anything you can get ingested. With the newly released Flows with Gravwell v.5 Orion, it's easier than ever to do the ingesting. Fellow developer Fritz has even built a Flow to check Best Buy's API to see if they have any PS5 consoles in stock (Read that here Gravwell Flows: Leveraging Best Buy API for Sony Playstation 5.

If you want to try out Gravwell Flows today with any public API, get your free Gravwell Community Edition licenses by clicking on the button below.

Once you are up and running, stop by our Discord and share questions or your build's success with the team: