skinkie / reference

Personal repository where I collect working examples to understand inner workings while building PyNeTExConv
GNU Affero General Public License v3.0
1 stars 1 forks source link

Referencing with order #100

Open ue71603 opened 2 months ago

ue71603 commented 2 months ago

The key error lets me assume that if we use order, then the reference must use order too. If we think this should not be necessary (or it is impossible, then probably we will need to change the code....

**************
Starting script: netex_db_to_gtfs.py with ['./aux_test_processing/netex-database.duckdb', './aux_test_processing/at1-gtfs.zip']
C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\.venv\Scripts\python.exe netex_db_to_gtfs.py ./aux_test_processing/netex-database.duckdb ./aux_test_processing/at1-gtfs.zip
C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\gtfsprofile.py:209: UserWarning: Can't handle at:vvv:Line:42711E.j24: because no agency can be found.
  warnings.warn(f"Can't handle {line.id} because no agency can be found.")
Traceback (most recent call last):
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\netex_db_to_gtfs.py", line 182, in <module>
    convert(archive, args.netex)
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\netex_db_to_gtfs.py", line 47, in convert
    with sqlite3.connect(database) as con:
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\netex_db_to_gtfs.py", line 121, in convert
    CallsProfile.getCallsFromTimetabledPassingTimes(service_journey, service_journey_pattern)
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\callsprofile.py", line 331, in getCallsFromTimetabledPassingTimes
    fare_scheduled_stop_point_ref_or_scheduled_stop_point_ref_or_scheduled_stop_point_view=ssp_refs[timetabled_passing_time.point_in_journey_pattern_ref.ref],
                                                                                           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'at:vvv:StopPointInJourneyPattern:31101E.j24-1-0020208:'

image

see also https://github.com/MMTIS/QA/issues/6

skinkie commented 2 months ago

This is absolutely correct. Our code takes a shortcut, for one of the more principle reasons that the original XML Schema did not enforce the order as mandatory attribute. But I wonder if something else is going on here: is the StopPointInJourneyPattern here actually of the ServiceJourneyPattern referenced by the ServiceJourney?

ue71603 commented 2 months ago

Then why do I get the key error?

skinkie commented 2 months ago

My guess: it is referencing a different ServiceJourneyPattern. Must investigate.