Giter VIP home page Giter VIP logo

tdnet-to-json's Introduction

TD.net to JSON

This Camel component will convert TD.net messages in XML format in to a lightweight JSON format.

If you don't know what TD.net is, or you don't have access, then this component is not for you.

The following message types are supported:

  • Train Describer - CA, CB, CC, CT, SF, SG and SH
  • Train Movement - all message types (excluding UnidentifiedTrainMovement)

Usage

Spring XML

<route id="testRoute">
  <from uri="queue:input"/>
  <to uri="tdToJson"/>
  <to uri="queue:output"/>
  </split>
</route>

Fluent Builders

RouteBuilder builder = new RouteBuilder() {
  public void configure() {
    Processor tdMessageProcessor = new TdMessageConverter();
    from("queue:a")
        .process(tdMessageProcessor))
        .to("queue:b");
  }
}

Train Movement data mapping

Train movement data is converted to the same JSON format as used by the Network Rail Data Feeds platform, making it easy to migrate between platforms.

TrainActivationMsgV1

JSON message type '0001'

XML JSON Type
OriginalTrainId train_id String
EventTimestamp creation_timestamp Timestamp
LocationStanox sched_origin_stanox String
WTTTimestamp origin_dep_timestamp Timestamp
UIDNumber train_uid String
ScheduleStartTimestamp schedule_start_date Timestamp
ScheduleEndTimestamp schedule_end_date Timestamp
ScheduleSource schedule_source String
ScheduleType schedule_type String
ScheduledWTTID schedule_wtt_id String
TOPSUID d1266_record_number String
TrainPlanOrigin tp_origin_stanox String
TrainPlanOriginTimestamp tp_origin_timestamp Timestamp
EventSource train_call_type String
TrainCallMode train_call_mode String
TOC toc_id String
TrainServiceCode train_service_code String
TrainFileAddress train_file_address String

NOTE: The TrainPlanOriginTimestamp field in XML is incorrectly sent as a date in Open Data, whereas it is converted to a Timestamp here.

TrainCancellationMsgV1

JSON message type '0002'

XML JSON Type
OriginalTrainID train_id String
EventTimestamp canx_timestamp Timestamp
LocationStanox loc_stanox String
WTTTimestamp dep_timestamp Timestamp
OriginStanox orig_loc_stanox String
OriginalWTTTimestamp orig_loc_timestamp Timestamp
TrainCancellationType canx_type String
TrainServiceCode train_service_code String
ReasonCode canx_reason_code String
Division division_code String
TOC toc_id String
TrainFileAddress train_file_address String

TrainMovementMsgV1

JSON message type '0003'

XML JSON Type
OriginalTrainID train_id String
EventTimestamp actual_timestamp Timestamp
LocationStanox loc_stanox String
GBTTTimestamp gbtt_timestamp Timestamp
WTTTimestamp planned_timestamp Timestamp
PlannedMovementType planned_event_type String
MovementType event_type String
EventSource event_source Boolean
RevisionFlag correction_ind Boolean
OffRouteFlag offroute_ind Boolean
Direction direction_ind String
Platform platform String
Route route String
TrainServiceCode train_service_code String
Division division_code String
TOC toc_id String
TimetableVariation timetable_variation String
VariationStatus variation_status String
NextLocationStanox next_report_stanox String
NextReportRunTime next_report_run_time String
TerminatedFlag train_terminated Boolean
DelayMonitoringFlag delay_monitoring_point Boolean
ReportingLocationStanox reporting_stanox String
AutoExpectedFlag auto_expected Boolean
TrainFileAddress train_file_address String

UnidentifiedTrainMsgV1

NOTE: This message has never been seen from TD.net.

TrainReinstatementMsgV1

JSON message type '0005'

XML JSON Type
OriginalTrainID train_id String
CurrentTrainID current_train_id String
EventTimestamp reinstatement_timestamp Timestamp
LocationStanox loc_stanox String
WTTTimestamp dep_timestamp Timestamp
TrainServiceCode train_service_code String
Division division_code String
TOC toc String
TrainFileAddress train_file_address String

NOTE: The original_loc_timestamp and orig_loc_stanox fields in Open Data JSON is not mapped to an XML field and has been excluded.

TrainChangeOriginMsgV1

JSON message type '0006'

XML JSON Type
OriginalTrainID train_id String
CurrentTrainID current_train_id String
EventTimestamp coo_timestamp Timestamp
LocationStanox loc_stanox String
WTTTimestamp dep_timestamp Timestamp
OriginalLocationStanox original_loc_stanox String
OriginalWTTTimestamp original_loc_timestamp Timestamp
TrainServiceCode train_service_code String
ReasonCode reason_code String
Division division_code String
TOC toc_id String
TrainFileAddress train_file_address String

TrainChangeIdentityMsgV1

JSON message type '0007'

XML JSON Type
OriginalTrainID train_id String
CurrentTrainID current_train_id String
EventTimestamp event_timestamp Timestamp
RevisedTrainID revised_train_id String
TrainServiceCode train_service_code String
TrainFileAddress train_file_address String

TrainChangeLocationMsgV1

JSON message type '0008'

XML JSON Type
OriginalTrainID train_id String
CurrentTrainID current_train_id String
EventTimestamp event_timestamp Timestamp
LocationStanox loc_stanox String
WTTTimestamp dep_timestamp String
OriginalLocationStanox original_loc_stanox String
OriginalWTTTimestamp original_loc_timestamp Timestamp
TrainCancellationType canx_type String
TrainServiceCode train_service_code String
ReasonCode reason_code String
Division division String
TOC toc_id String
TrainFileAddress train_file_address String

tdnet-to-json's People

Contributors

poggs avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

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.