Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions input/input_Bern_Belp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<OJP xmlns="http://www.siri.org.uk/siri" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ojp="http://www.vdv.de/ojp" xsi:schemaLocation="http://www.siri.org.uk/siri ../ojp-xsd-v1.0/OJP.xsd" version="1.0">
<OJPRequest>
<ServiceRequest>
<RequestorRef>OJP SDK v1.0</RequestorRef>
<RequestTimestamp>2023-08-08T11:35:38.145Z</RequestTimestamp>
<ojp:OJPTripRequest>
<RequestTimestamp>2023-08-08T11:35:38.145Z</RequestTimestamp>
<ojp:Origin>
<ojp:PlaceRef>
<StopPointRef>8507076</StopPointRef>
<ojp:LocationName>
<ojp:Text>Belp</ojp:Text>
</ojp:LocationName>
</ojp:PlaceRef>
<!-- <ojp:DepArrTime>2024-12-16T08:43:42.788Z</ojp:DepArrTime> -->
</ojp:Origin>
<ojp:Destination>
<ojp:PlaceRef>
<StopPointRef>8507000</StopPointRef>
<ojp:LocationName>
<ojp:Text>Bern</ojp:Text>
</ojp:LocationName>
</ojp:PlaceRef>
</ojp:Destination>
<ojp:Params>
<ojp:NumberOfResultsAfter>6</ojp:NumberOfResultsAfter>
<ojp:IncludeTrackSections>false</ojp:IncludeTrackSections>
<ojp:IncludeLegProjection>false</ojp:IncludeLegProjection>
<ojp:IncludeTurnDescription>false</ojp:IncludeTurnDescription>
<ojp:IncludeIntermediateStops>true</ojp:IncludeIntermediateStops>
</ojp:Params>
</ojp:OJPTripRequest>
</ServiceRequest>
</OJPRequest>
</OJP>
41 changes: 41 additions & 0 deletions input/input_problematic_Europaplatz_4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<OJP xmlns="http://www.vdv.de/ojp" xmlns:siri="http://www.siri.org.uk/siri" version="2.0">
<!-- https://tools.odpch.ch/ojp-demo-v2/search?from=8571342&to=8504102&trip_datetime=2025-07-17%2016:57 -->
<OJPRequest>
<siri:ServiceRequest>
<siri:ServiceRequestContext>
<siri:Language>de</siri:Language>
</siri:ServiceRequestContext>
<siri:RequestTimestamp>2025-07-22T12:51:35.026Z</siri:RequestTimestamp>
<siri:RequestorRef>OJP_DemoApp_Beta_OJP2.0</siri:RequestorRef>
<OJPTripRequest>
<siri:RequestTimestamp>2025-07-22T12:51:35.027Z</siri:RequestTimestamp>
<Origin>
<PlaceRef>
<StopPlaceRef>8507076</StopPlaceRef>
<Name>
<Text>Belp</Text>
</Name>
</PlaceRef>
</Origin>
<Destination>
<PlaceRef>
<StopPlaceRef>8507000</StopPlaceRef>
<Name>
<Text>Bern</Text>
</Name>
</PlaceRef>
</Destination>
<Params>
<IncludeAllRestrictedLines>true</IncludeAllRestrictedLines>
<NumberOfResults>5</NumberOfResults>
<IncludeTrackSections>true</IncludeTrackSections>
<IncludeLegProjection>false</IncludeLegProjection>
<IncludeTurnDescription>true</IncludeTurnDescription>
<IncludeIntermediateStops>true</IncludeIntermediateStops>
<UseRealtimeData>explanatory</UseRealtimeData>
</Params>
</OJPTripRequest>
</siri:ServiceRequest>
</OJPRequest>
</OJP>
42 changes: 42 additions & 0 deletions input/input_test_europaplatz.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<OJP xmlns="http://www.vdv.de/ojp" xmlns:siri="http://www.siri.org.uk/siri" version="2.0">
<OJPRequest>
<siri:ServiceRequest>
<siri:ServiceRequestContext>
<siri:Language>de</siri:Language>
</siri:ServiceRequestContext>
<siri:RequestTimestamp>2026-01-28T20:14:42.089Z</siri:RequestTimestamp>
<siri:RequestorRef>OJP_DemoApp_Beta_OJP2.0</siri:RequestorRef>
<OJPTripRequest>
<siri:RequestTimestamp>2026-01-28T20:14:42.090Z</siri:RequestTimestamp>
<Origin>
<PlaceRef>
<StopPlaceRef>8507000</StopPlaceRef>
<Name>
<Text>n/a</Text>
</Name>
</PlaceRef>
<IndividualTransportOption/>
</Origin>
<Destination>
<PlaceRef>
<StopPlaceRef>8507099</StopPlaceRef>
<Name>
<Text>n/a</Text>
</Name>
</PlaceRef>
<IndividualTransportOption/>
</Destination>
<Params>
<NumberOfResults>5</NumberOfResults>
<IncludeAllRestrictedLines>true</IncludeAllRestrictedLines>
<IncludeTrackSections>true</IncludeTrackSections>
<IncludeLegProjection>false</IncludeLegProjection>
<IncludeTurnDescription>true</IncludeTurnDescription>
<IncludeIntermediateStops>true</IncludeIntermediateStops>
<UseRealtimeData>explanatory</UseRealtimeData>
</Params>
</OJPTripRequest>
</siri:ServiceRequest>
</OJPRequest>
</OJP>
3 changes: 2 additions & 1 deletion map_ojp2_to_ojp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def map_to_individual_ojpfarerequest(trip: TripStructure, now: XmlDateTime) -> O
# ojprefinement_request=refinerequest)))

def preprocess_stops_to_commercial_stops(delivery: OjptripDeliveryStructure) -> OjptripDeliveryStructure:
#prepocessing every StopPointRef is replaced with the highestmost parent for the processing in fares
#prepocessing every StopPointRef is replaced with the highest most parent for the processing in fares
#parse context and create a dictionnary of the highest parent
#as this does not work if no context exists we will have to do the dictionnary also in sloid2didok
parent = {}
#TODO we do it once only, but in future we might to change it
if not delivery.trip_response_context:
Expand Down
9 changes: 9 additions & 0 deletions support.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ def sloid2didok(sloid:str)->int:
# TODO this is a hack for the timetable change 2024/2025 must be done correctly in map_ojp_to_ojp.py by replacing the stoppoints with the correct didoks
#if a didok code, just return it
my_dict: Dict[str,str] ={
"8507082": "8504108",
"8503088": "8503000",
"8519342": "8504014",
"8014488": "8503467",
"8014482": "8503466",
"8014483": "8503465",
"8014484": "8503464",
"8014485": "853463",
"8014487": "8503462",
}
#dict from https://confluence.sbb.ch/pages/viewpage.action?pageId=2608861819
#"8507082": "8504108",
Expand Down
27 changes: 27 additions & 0 deletions test_configuration.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
READFILE = []


READFILE.append("input/input_Bern_Belp.xml")

READFILE.append("input/input_oev_shart_plus_long.xml")
READFILE.append("input/input_Zuerich_Chur.xml")
READFILE.append("input/input_Visp_SaaS_Fee_problem_1_preis.xml") #1. class price problematic
READFILE.append("input/input_strange_price.xml")
READFILE.append("input/input_Zuerich_Bern.xml")
READFILE.append("input/input_Basel_Sargans.xml")
READFILE.append("input/input_Bern_Interlaken_Ost.xml")
READFILE.append("input/input_Bern_Interlaken_Gymnasium.xml")
READFILE.append("input/input_Bern_Guisanplatz_Interlaken_Gymnasium.xml")
READFILE.append("input/input_local.xml")
READFILE.append("input/input_oev_shart_plus_long.xml")
READFILE.append("input/input_bus_postauto.xml")
READFILE.append("input/input_sharing_intercity.xml")
READFILE.append("input/input_problematic_case_vasile.xml")
READFILE.append("input/input_Europaplatz.xml")
READFILE.append("input/input_Bodensee_1.xml")
READFILE.append("input/input_test_europaplatz.xml")


# Working OJP 2.0 example
#READFILE.append("input/input_ojp_1_test.xml")
READFILE.append("input/input_ojp_2_test.xml")
READFILE.append("input/input_problematic_Europaplatz_ojp1.xml")
READFILE.append("input/input_problematic_Europaplatz_ojp2.xml")
READFILE.append("input/input_Bodensee_2.xml")
READFILE.append("input/input_problem_footpath.xml")
READFILE.append("input/input_problematic_Europaplatz_4.xml")

'''
----------------------------------------------------------------
Reservoir for tests

# Working OJP 1.0 examples
READFILE.append("input/input_Bern_Belp.xml")

READFILE.append("input/input_oev_shart_plus_long.xml")
READFILE.append("input/input_Zuerich_Chur.xml")
READFILE.append("input/input_Visp_SaaS_Fee_problem_1_preis.xml") #1. class price problematic
Expand All @@ -29,6 +54,7 @@
READFILE.append("input/input_problematic_case_vasile.xml")
READFILE.append("input/input_Europaplatz.xml")
READFILE.append("input/input_Bodensee_1.xml")
READFILE.append("input/input_test_europaplatz.xml")


# Working OJP 2.0 example
Expand All @@ -38,6 +64,7 @@
READFILE.append("input/input_problematic_Europaplatz_ojp2.xml")
READFILE.append("input/input_Bodensee_2.xml")
READFILE.append("input/input_problem_footpath.xml")
READFILE.append("input/input_problematic_Europaplatz_4.xml")



Expand Down
2 changes: 1 addition & 1 deletion test_nova_r_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def send_nova(url: str, headers: dict, xml_body: str) -> requests.Response:
with open(READFILE, 'r', encoding='utf-8') as inputfile:
nova_request = inputfile.read()
# send it to NOVA
oauth_helper = OAuth2Helper(client_id=NOVA_CLIENT_ID, client_secret=NOVA_CLIENT_SECRET)
oauth_helper = OAuth2Helper(client_id=NOVA_CLIENT_ID, client_secret=NOVA_CLIENT_SECRET, scope=NOVA_SCOPE)
access_token = oauth_helper.get_token()
headers = {'Authorization': 'Bearer ' + access_token,
'SOAPAction': 'http://nova.voev.ch/services/v14/preisauskunft/erstellePreisAuskunft',
Expand Down