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

TimetabledPassingTime and no id/version #97

Open ue71603 opened 4 days ago

ue71603 commented 4 days ago

at latest this results in an error when converting it to GTFS


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 328, in getCallsFromTimetabledPassingTimes
    call = Call(id = timetabled_passing_time.id.replace(":TimetabledPassingTime:", ":Call:"),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

and I added some code to add it aux_always_add_id_version.py. However, it seems a general problem that they don't do it and TimetabledPassingTime is never referenced. All the RefStructures are defined, but they are not included anywhere in the XSD.

So, perhaps we should add some code that creates unique id on the fly, when the id/version is missing during netex_to_db.py?

skinkie commented 4 days ago

Can you include a source file?

ue71603 commented 3 days ago

The source is here: https://github.com/MMTIS/QA/issues/5 referenced

I use a preprocessed file, where I already cleaned some problems (datasourceRef and the responsibilitySetRef) by removing them. Probably not the best idea ;-)

netex-export.zip Should I write a new program that generates stubs instead of removing them?

and then added new id to all TimetabledPassingTime. netex-export1.zip

Then I ran into a new problem:


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: 'it:apb:StopPointInJourneyPattern:224353.24a-1-0020209:'

at least in the XML it is there.

program sequence:

 {
    "block": "bolzano",
    "scripts": [
        {"script": "clean_tmp", "args": ["d:/aux_test_processing"]},
        {"script": "netex_to_db.py", "args": ["d:/aux_test_processing/netex-export1.xml d:/aux_test_processing/netex-import.duckdb"]},
        {"script": "netex_db_to_gtfs.py", "args": ["d:/aux_test_processing/netex-import.duckdb d:/aux_test_processing/bolzano-gtfs.zip"]},
        {"script": "gtfs_show_map.py", "args": ["d:/aux_test_processing/bolzano-gtfs.zip d:/aux_test_processing/bolzano-map.html routes"]}
        ]
  },
ue71603 commented 3 days ago

There are also a lot of warnings:


StopPlaceEntrance it:apb:StopPlaceEntrance:it-22024-97149: does not have a location or centroid.
StopPlaceEntrance it:apb:StopPlaceEntrance:it-22101-3281: does not have a location or centroid.
StopPlaceEntrance it:apb:StopPlaceEntrance:it-22101-3281: does not have a location or centroid.

Can I ignore them or are they also indicating a data problem?

skinkie commented 3 days ago

I think for going to GTFS it will then inherit the location from the StopPlace itself, but it is obviously a data problem. Why would someone make a StopPlaceEntrance, without telling where it is?

ue71603 commented 2 days ago

I will add the problem with the StopPlaceEntrance to my complaints to STA.