Git Product home page Git Product logo

vagstatstracker's Introduction

VAG Stats Tracker

Install

Goal

Features

ToDo:

  • Track delays of everything
    • Bus
    • U-Bahn
    • Tram
  • Live Map of ALL services
  • Generate Heatmaps of delays
  • Geoline API - Get exact WGS84 coordinates for lines with rails
  • Stops API
  • Toplist

Things i´d like to do but got not enough time for:

  • Easy way to report delays or other stuff (Not directly to the company)
  • Smart warnings of potential delays
  • Link common delay causes to the average delay they cause
  • Track Elevator malfunctions and duration
  • Smarter departure lookup endpoint
  • Smarter connection lookup endpoint
  • Something like Flightradar24s "People on my plane"
  • Smart alexa alarmclock (Alexa, wake me up so i´ll be in scool by 8 o´clock)
  • New API Methods to extend the VAG PULS API (If i figure out how to install PGSQL Plugins, lol)
  • More...

Pictures:

Real Time Map

grafik

Vehicle + Accessibility info

For private vehicles this information isn't avaible and the VAG also doesn't know all the Vehicles (Laziness on their part)
Bus: (Operator) Displays AC Avaibility, Wheelchair Spots and Fule type (Diesel, Gasoline, Gas or Electro)
grafik
Tram: (Operator) and Door configuration (Wheelchair accessible or not)
grafik

Delay Heat Map

Displays all delays of a date or timespan on the map grafik

API

Stops

/search Parameters:

  • Haltestellenname: String
  • VGNKennung: Int
  • VAGKennung: String
  • Latitude: Int -Min/Max=180 optional
  • Longitude: Int -Min/Max=180 optional
  • Produkte: String (Bus,Tram,Ubahn)

/location Parameters:

  • Latitude: Int -Min/Max=180 optional
  • Longitude: Int -Min/Max=180 optional
  • Radius: Number -Max=40000KM

Geolines

/:line Possible: 4,5,6,7,8,10,11,U1,U2,U3

Toplists

/delay/:list Possible: by_stops, by_lines, by_vehicles Parameters:

  • at: String (YYYY-MM-DD)
  • from: String (YYYY-MM-DD) - Not fully added
  • to: String (YYYY-MM-DD) - Not fully added

Live

/all Returns all current trips
/map Parameters:

  • Linie: String

Heatmap

/ Parameters:

  • at: String (YYYY-MM-DD)
  • from: String (YYYY-MM-DD) - Experimentell
  • to: String (YYYY-MM-DD) - Experimentell

Install

Windows

Requirements:

  • Docker Desktop
  • NodeJs 20
  • PGAdmin (or other PG Interface)
  • Some IDE
  • Redis Insight (Optional)

Steps:

  1. Create containers with docker compose up -d in some powershell window in the root of the repo.
  2. Use SQL Tool (PGAdmin) to generate a DB. Default user admin and password adminpassword
  3. You need to make a .env Can be fond below File in all programs you wanna use:
    • FahrtenProcessor (Tracks a ongoing trip)
    • FahrtenScanner (Finds new trips)
    • WebService (Provides /metrics endpoint and all API routes)
  4. Run programs in order, start al programs from their root:
    • Go into /WebService and run node index.js wait till it its ready
    • Go into /FahrtenScanner and run node index.js (If you already had it running run node /tools/clearRedis.js to wipe the cache)
    • Go into /FahrtenProcessor and run node index.js
  5. You know its working when Scanner shows a lot of things realy fast, and Processor starts picking up all the jobs over the next couple of seconds

EnvSetup

WebService

# Application
APPLICATION=WebService
DOMAIN=http://localhost
FALLBACKLANG=de

# Logging
LOG_LEVEL=4# 0 = error, 1 = warning, 2 = info, 3 = debug, 4 = system
LOG_TYPE=console# console or stdout
LOG_COLOR=true# true or false
LOG_TEMPLATE=# leave empty for default or enter a custom template
LOG_STACK=false
SENTRY_DSN=#Optional

# Database PG
DB_HOST="localhost"
DB_PORT=5432
DB_NAME="<Your Generated DB Name"
DB_USER="admin"
DB_PASSWORD="adminpassword"

# Database Redis (Cache)
REDIS_USER="default"
REDIS_PASSWORD="example"
REDIS_HOST="localhost"
REDIS_PORT=6379
REDIS_DB=0

# Webserver
GLOBALWAITTIME=0 # Delay in ms until /src is loaded
EXTRAERRORWEBDELAY=0
PORT=80 # Port for webserver

# Security
# HashSalts can be modifyed any time but will not apply to existing hashes... also keep in mind 0 will disable the hash, then all hashed IPs will not work because its switches to direct IP comparison
SALTROUNDS=12 # Salt rounds for password hashing
WEBTOKENLENGTH=64 # Length of the Web Token
WebTokenDurationH=96 # How long the Web Token is valid for in hours
Web2FAValidForMin=5 # How long the 2FA token is valid for in minutes

# Limiter
DECREASEPERMIN=120 # Used for Limiter

# Proxy Settings
# This can be exploited if your proxy does not overwrite the headers
# It will also display a warning if proxyed requests are comming in but are not enabled here
CLOUDFLARE_PROXY=false
ANY_PROXY=false

# Cache Settings
CACHEDRIVER=local # Can also be redis

# HyperExpress Settings (Webserver)
HE_FAST_BUFFERS=false # If true, will use allocUnsafe

FahrtenScanner & FahrtenProcessor

APPLICATION=FahrtenScanner #or FahrtenProcessor

# LOGGING
LOG_LEVEL=4
LOG_TYPE=console# console or stdout
LOG_COLOR=true# true or false
LOG_TEMPLATE=# leave empty for default or enter a custom template
SENTRY_DDSN=

# GENERAL
PRODUCTS=UBahn,Bus,Tram # Things you wanna track
WATCHDOG_TIMEOUT=60

# Database PG
DB_HOST="localhost"
DB_PORT=5432
DB_NAME="<Your Generated DB Name"
DB_USER="admin"
DB_PASSWORD="adminpassword"

# Database Redis (Cache)
REDIS_USER="default"
REDIS_PASSWORD="example"
REDIS_HOST="localhost"
REDIS_PORT=6379
REDIS_DB=0

SCANBEFORE=30 # Scan before x seconds
SCAN_INTERVAL=5 # Scan every x seconds
ERROR_EXPIRE=600 # Expire errors after X seconds

Project (The kickstarted still didn´t deliver :/)

Unlike my other projects this project will be built around my learning curve to cloud like software architecture.
Target Hardware:

  • 4 Nodes each with:
  • 8x ARMv8 SoC
  • 16 GB DDR4
  • 1 TB NVME
  • 1 Gbit/s LAN

vagstatstracker's People

Contributors

bolverblitz avatar darkintaqt avatar

vagstatstracker's Issues

Final Stops are missing (Probably the cause for the heavy amount of leaked keys)

SELECT h.haltestellenname, fh.vgnkennung, fh.fahrtnummer, fh.richtungstext, fh.ankunftszeitsoll, fh.ankunftszeitverspätung, fh.abfahrtszeitsoll, fh.abfahrtszeitverspätung FROM fahrten_halte fh INNER JOIN haltestellen h ON h.VGNKennung = fh.VGNKennung
ORDER BY fahrtnummer ASC, betriebstag ASC, produkt ASC, fh.abfahrtszeitsoll ASC

Examples:

grafik

grafik

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.