Thanks to visit codestin.com
Credit goes to github.com

Skip to content

AlessandroVacca/dima-polimi-trenord

Repository files navigation

TrenordLink

A comprehensive iOS application designed to enhance the safety and travel experience of Trenord rail service passengers. TrenordLink integrates real-time train information, location sharing, emergency reporting, and trip planning into a single, user-friendly interface. For context, Trenord operates the regional rail service across the entire Lombardy region in Northern Italy, serving nearly 800,000 passengers every day.

⚠️ Important Notice

All proprietary assets rights belong to the Trenord Company. This project is developed for educational and research purposes as part of the Design and Implementation of Mobile Applications (DIMA) course at Politecnico di Milano, held by Prof. Luciano Baresi, for the AY 2024/25.

πŸš‚ About

TrenordLink addresses the challenges faced by public transit users by providing:

  • Real-time train tracking and station information
  • Integrated safety features including location sharing with trusted contacts
  • Emergency reporting system with direct communication to train conductors
  • Comprehensive trip planning with route search and bookmarking
  • Cross-platform support for iPhone and iPad with optimized interfaces

🎯 Key Features

Core Functionality

  • Route Search & Trip Planning: Search for train routes between stations with detailed information including departure/arrival times, duration, and intermediate stops
  • Real-time Map Integration: Interactive map displaying user location, Trenord stations, and real-time friend locations
  • Saved Trips: Bookmark frequently used routes for quick access
  • Recent Searches: Automatically saved search history for convenience

Safety Features

  • Friend Location Sharing: Share live location with trusted contacts for defined periods (2, 8, or 24 hours)
  • Emergency Reporting: Report emergencies directly from the app with automatic location and train information
  • Conductor Panel: Dedicated interface for train conductors to manage and respond to emergencies
  • Background Location Services: Continue location sharing even when app is in background

User Experience

  • Cross-platform UI: Responsive design optimized for both iPhone and iPad
  • User Authentication: Secure registration and login system
  • Profile Management: Comprehensive user profile with friend management capabilities
  • Real-time Updates: Live updates every 15 seconds for location and train information

πŸ—οΈ Architecture

System Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   iOS App       │────▢│   Firebase      │◀────│ Admin Scripts   β”‚
β”‚   (SwiftUI)     β”‚     β”‚   Backend       β”‚     β”‚   (Node.js)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Technology Stack

  • Frontend: Swift, SwiftUI, iOS SDK
  • Backend: Firebase (Firestore, Authentication, Admin SDK)
  • Admin Tools: Node.js scripts for database management
  • External APIs: Custom Trenord API for real-time train data

πŸ“ Project Structure

dima-polimi-trenord/
β”œβ”€β”€ trenordsafe/                    # iOS Application
β”‚   β”œβ”€β”€ Models/                     # Data models
β”‚   β”œβ”€β”€ Views/                      # SwiftUI views
β”‚   β”œβ”€β”€ ViewModels/                 # MVVM view models
β”‚   β”œβ”€β”€ Providers/                  # Data providers
β”‚   β”œβ”€β”€ Services/                   # Core services
β”‚   └── Networking/                 # API clients
β”œβ”€β”€ trenordsafeTests/               # Unit tests
β”œβ”€β”€ trenordsafeUITests/             # UI tests
β”œβ”€β”€ scripts/                        # Node.js admin scripts
β”œβ”€β”€ docs/                           # Documentation
β”œβ”€β”€ dimatex/                        # LaTeX documentation
β”œβ”€β”€ firestore.rules                 # Firebase security rules
└── package.json                    # Node.js dependencies

πŸš€ Getting Started

Prerequisites

  • Xcode 14.0 or later
  • iOS 16.0 or later
  • Node.js 18.0 or later
  • Firebase account with active project

iOS App Setup

  1. Clone the repository

    git clone https://github.com/AlessandroVacca/dima-polimi-trenord.git
    cd dima-polimi-trenord
  2. Open the iOS project

    open trenordsafe.xcodeproj
  3. Configure Firebase

    • Add your GoogleService-Info.plist to the trenordsafe/ directory
    • Ensure Firebase Authentication and Firestore are enabled
  4. Build and run

    • Select your target device/simulator
    • Build and run the project (⌘+R)

Backend Scripts Setup

  1. Install Node.js dependencies

    npm install
  2. Configure Firebase Admin SDK

    • Place your Firebase Admin SDK key file in the root directory
    • Update the path in scripts if necessary
  3. Run admin scripts

    node scripts/setup-users-db.js
    node scripts/upload-stations.js

πŸ§ͺ Testing

Unit Tests

# Run from Xcode
⌘+U

UI Tests

# Run specific UI test schemes
xcodebuild test -scheme trenordsafe-iPhone -destination 'platform=iOS Simulator,name=iPhone 14'

Test Coverage

  • Unit Tests: Comprehensive coverage of ViewModels, Models, and Services
  • UI Tests: End-to-end testing of user workflows
  • Integration Tests: Authentication, emergency reporting, and location services

πŸ“Š Data Management

Database Schema

The application uses Firestore with the following main collections:

  • users: User profiles and authentication data
  • trips: Saved trip information
  • emergencies: Emergency reports and status
  • friends: Friend relationships and location sharing permissions
  • stations: Trenord station data with coordinates

Admin Scripts

Available in the scripts/ directory:

  • setup-users-db.js: Initialize user database
  • upload-stations.js: Upload station data
  • clear-friendships.js: Reset friendship data
  • upgrade-user-to-conductor.js: Grant conductor privileges

πŸ”’ Security & Privacy

Data Protection

  • Firebase Security Rules: Comprehensive rules defined in firestore.rules
  • User Authentication: Secure Firebase Authentication integration
  • Location Privacy: Granular control over location sharing duration and recipients
  • Emergency Data: Secure handling of sensitive emergency information

Privacy Features

  • Selective Sharing: Users control who can see their location and for how long
  • Emergency Context: Location and train information automatically included in emergency reports
  • Data Retention: Configurable data retention policies

🌐 API Integration

Trenord API

see [Insert repo link]

External Dependencies

  • api-trenitalia: Italian train data integration
  • Firebase Admin SDK: Backend administrative operations
  • Core Location: iOS location services

πŸ“„ License

This project is developed for educational purposes as part of the DIMA course at Politecnico di Milano. All proprietary assets and rights belong to Trenord Company.

πŸ”— Documentation

For detailed technical documentation, see the docs/ directory:

This project is developed for educational purposes. All Trenord trademarks, logos, and proprietary information belong to Trenord Company.

About

Trenord app developed for the DIMA course @ Polimi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors