Skip to content

chenxy12345/Vessel_Tracker

 
 

Repository files navigation

Vessel Tracker Application

Overview

The Vessel Tracker Application is a comprehensive tool designed to track and analyze vessel proximity data in real-time. The application connects to the AIS Stream API, logs vessel data, processes proximity logs, and provides an intuitive interface for users to search and analyze compiled proximity logs.


Features

  • Real-time Data Streaming: The application listens to AIS Stream API to fetch live vessel data.
  • Daily Log Management:
    • Creates a new daily CSV file with appropriate headers if one does not already exist.
    • Appends incoming stream data to the current day's CSV file.
    • At midnight (12:05 AM), processes the previous day's data and appends it to the compiled proximity logs.
  • Proximity Detection: Calculates proximity between vessels based on geographic coordinates.
  • Interpolation: Fills gaps in position data (greater than 5 minutes) with interpolated points for accurate proximity calculations.
  • Search Functionality: Allows users to search logs by vessel name and date range.
  • Cache Management: Periodically clears cache every 6 hours to prevent memory issues during extended runs.
  • UI Features:
    • Displays compiled logs in a table format.
    • Allows users to generate logs and search for specific vessel information.
    • Logs system messages and errors in a log display area.

Application Components

1. Real-Time Data Streaming

  • Connects to the AIS Stream API using WebSocket.
  • Writes incoming data to a daily CSV file. If the file does not exist, it creates a new file with headers.

2. Daily Log Management

  • At midnight (12:05 AM), the previous day's data is processed using proximity detection logic and appended to the compiled proximity logs.

3. Proximity Detection Logic

  • Detects when two vessels are within a defined proximity (e.g., 100 meters).
  • Accounts for data gaps by interpolating missing data points when gaps exceed 5 minutes.

4. User Interface

  • Log Table: Displays compiled logs in a sortable table format.
  • Search Bar: Filters logs by vessel name and date range.
  • Log Display: Shows system messages and errors in real-time.
  • Generate Logs Button: Allows manual compilation of logs from daily CSV files.

File Structure

vessel_tracker/ │ ├── vessel_tracker_app.py # Main application file ├── requirements.txt # List of dependencies ├── compiled_proximity_logs.csv # Compiled logs (generated at runtime) ├── vessel_data_YYYY-MM-DD.csv # Daily logs (generated at runtime) └── README.md # This README file


Usage Instructions

  1. Starting the software

    • Enter the command
    python vessel_tracker_app.py

    or

    python .\vessel_tracker_app.py
    • in terminal under the program directory.
  2. Streaming Data:

    • The application begins streaming data upon launch.
    • Ensure your API key is valid and network connectivity is available.
  3. Search Logs:

    • Enter a vessel name in the search bar.
    • Select a date range and click the search button.
  4. Generate Compiled Logs:

    • Use the "Generate Compiled Logs" button to manually compile logs from existing daily files.

Troubleshooting

Common Errors

  • "Cannot queue arguments of type 'QTextCursor':

    • Ensure the log_message method uses the signal-slot mechanism to update the UI.
  • "No close frame received or sent":

    • Check network connectivity or API key validity.
    • The WebSocket listener retries the connection automatically.
  • "No daily log file found for [date]":

    • Ensure data streaming was active on the specified date.

Future Enhancements

  • Implement advanced analytics features for proximity trends.
  • Add support for additional WebSocket message types.
  • Enhance the UI with additional data visualization.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Support

For questions or issues, please contact me at darren.lim.off@gmail.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%