atom14/tsr-feed 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

atom14/tsr-feed

Composer 安装命令:

composer require atom14/tsr-feed

包简介

Get TSRs from Rail Data Marketplace

README 文档

README

Rail Data Marketplace

Register for an account at https://raildata.org.uk/dashboard

Add a subscription for "NWR Temporary Speed Restrictions (TSR)"

Credentials

Access credentials will need to be available in the environment. I recommend PHPDotEnv. Copy the items from ".env.sample" to your environment and populate with the credentials from the RDM "Pub/Sub" tab as shown below:

Rail Data Marketplace Feed Credentials

Consume Data

Use "composer run consume" to connect to the Kafka server and pull available messages. Each message is stored to a separate file under ./data

Progress is logged in './log'

This tool is designed to run as a scheduled task / cron job. It only needs run on a Friday from 6am.

Data Source and Format

The feed utilises Kafka (https://en.wikipedia.org/wiki/Apache_Kafka), "a unified, high-throughput, low-latency platform for handling real-time data feeds"

The data is provided in JSON format.

Although Kafka allows for replaying previous messages, this feed is configured to only keep them for 1 hour.

You can use "composer run seek-offset" to validate this.

Weekly Operating Notice (WON)

The WON is issued weekly to inform interested parties of planned work over the following week. It comes out at 6am (UK time?) on a Friday.

This feed provides all the Temporary Speed Restrictions (TSRs) that are in the WON (i.e. those already in force or those coming into force during the week).

Messages

There is a message for each route. These are saved into a date+time stamped JSON file in the ./data folder ready for further processing such as adding to a database.

Message Structure

We have provided 'model' classes for the 'won_route' and 'tsr'

TSR Item

The "Tsr" class models an individual TSR as below.

NOTE: TSRID is NOT unique! But a combination of RouteCode+TSRID should be.

    {
        "RouteGroupName": "Anglia",
        "RouteCode": "EA1010",
        "RouteOrder": "10",
        "TSRReference": "T2026/232801",
        "FromLocation": "Romford",
        "ToLocation": "Harold Wood",
        "LineName": "Down Main",
        "SubunitType": "chains",
        "MileageFrom": "13",
        "SubunitFrom": "5",
        "MileageTo": "14",
        "SubunitTo": "21",
        "MovingMileage": "false",
        "PassengerSpeed": "50",
        "FreightSpeed": "50",
        "ValidFromDate": "1776830400000",
        "ValidToDate": "1790740800000",
        "Reason": "Track - Other",
        "Requestor": "Network Rail Maintenance (Romford)",
        "Comments": "EXTENDING EXISTING TSR T2025/230371 ON THE DOWN MAIN AT GIDEA PARK",
        "Direction": "down",
        "TSRID": "232801",
        "creationDate": "1776059873000",
        "publishDate": "1781244005000",
        "publishEvent": "nonSpecific"
    }

Won Item

The "RouteWon" class models the content of "TSRBatchMsg", the other properties do not seem useful.

    {
        "TSRBatchMsgV1": {
            "TSRBatchMsg": {
                "tsr": [ ... ],
                "routeGroup": "Anglia",
                "routeGroupCode": "2652",
                "publishDate": "1781244005000",
                "publishSource": "WON_2627_12_F",
                "routeGroupCoverage": "full",
                "batchPublishEvent": "publishWON",
                "WONStartDate": "1781910060000",
                "WONEndDate": "1782514740000"
            },
            "Sender": {
                "organisation": "Network Rail",
                "application": "HUB",
                "applicationDomain": "net"
            },
            "Publication": {
                "TopicID": "TSR/2652"
            },
            "classification": "industry",
            "timestamp": "1781241001000",
            "owner": "Network Rail",
            "originMsgId": "2026-06-12T07:10:02.087+01:00-2652@PPS",
            "systemEnvironmentCode": "Production"
        }
    }

License

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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固