rijdendetreinen / rdt-serviceinfo

HTTP interface for train schedules
GNU General Public License v3.0
3 stars 2 forks source link

Inject services to rdt-infoplus-dvs #3

Closed geertw closed 9 years ago

geertw commented 9 years ago

The rdt-infoplus-dvs application allows to inject services that are not available in the NS InfoPlus data source. This feature is mainly to inject rail replacement bus services and some international train services.

These services are available in rdt-serviceinfo. Rdt-serviceinfo should have an injection feature, allowing to inject selected services into a rdt-infoplus-dvs instance.

The injection is performed using zeromq, and uses (for now) pyobj to send dictionaries for each injected service.

The dictionary currently accepted by rdt-infoplus-dvs contains:

service['rit_id']
service['rit_station']
service['stop_idx']
service['vertrek']
service['servicedate']
service['bestemming_naam']
service['bestemming_code']
service['soort_code']
service['soort']
service['spoor']
service['vervoerder_code']
service['vervoerder_naam']
service['treinnr']
service['variant']
service['niet_instappen']
service['via']
service['attributes']

When needed, this list may be extended, translated or changed otherwise, but at the same time, those changes must be made in rdt-infoplus-dvs too.

geertw commented 9 years ago

Injections will use a new format (using English keys instead of Dutch) and will be in JSON format instead of pyobj. The format will be like this example service:

{
    "company": "NS", 
    "departure": "2015-05-15T00:29:00+02:00", 
    "destination_code": "rhn", 
    "destination_text": "Rhenen", 
    "do_not_board": false, 
    "platform": null, 
    "service_date": "2015-05-14", 
    "service_id": "33382", 
    "service_number": "0", 
    "stop_code": "mrn", 
    "transmode_code": "NSB", 
    "transmode_text": "Stopbus i.p.v. trein", 
    "via": [
        [
            "vndw", 
            "Veenendaal West"
        ], 
        [
            "vndc", 
            "Veenendaal Centrum"
        ]
    ]
}

Do not board and other attributes are not processed yet. All other fields are implemented in the injection module.

geertw commented 9 years ago

Main points that need to be addressed:

geertw commented 9 years ago

Format is now:

{
    "company": "DB",
    "departure": "2015-05-17T00:47:00+02:00",
    "destination_code": "es",
    "destination_text": "Enschede",
    "do_not_board": false,
    "platform": null,
    "service_date": "2015-05-16",
    "service_id": "42279",
    "service_number": "20218",
    "stop_code": "emte",
    "stops": [
        [
            "eop",
            "Ochtrup"
        ],
        [
            "g",
            "Gronau Westf"
        ],
        [
            "gbr",
            "Glanerbrug"
        ],
        [
            "ese",
            "Enschede De Eschmarke"
        ],
        [
            "es",
            "Enschede"
        ]
    ],
    "transmode_code": "ST",
    "transmode_text": "stoptrein",
    "via": [
        [
            "eop",
            "Ochtrup"
        ],
        [
            "g",
            "Gronau Westf"
        ],
        [
            "gbr",
            "Glanerbrug"
        ]
    ]
}

Missing: implementation of do-not-board, cancelled stops and other attributes.