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

new milano file with problems #89

Open ue71603 opened 1 month ago

ue71603 commented 1 month ago

Can you check what the problem is:


C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\transformers\epip.py:363: UserWarning: No uic_operating_periods available, submit this example to github
  warnings.warn("No uic_operating_periods available, submit this example to github")
Traceback (most recent call last):
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\epip_db_to_db.py", line 55, in <module>
    main(args.source, args.target)
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\epip_db_to_db.py", line 45, in main
    epip_service_journey_generator(source_database_file, target_database_file, generator_defaults, None)
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\transformers\epip.py", line 435, in epip_service_journey_generator
    with sqlite3.connect(write_database) as write_con:
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\transformers\epip.py", line 457, in epip_service_journey_generator
    service_calendar = get_service_calendar(day_types, uic_operating_periods, day_type_assignments, generator_defaults)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ue71603\MG_Daten\github\reference1\gtfs-netex-test\transformers\epip.py", line 365, in get_service_calendar
    from_date = min([uic.from_operating_day_ref_or_from_date.to_datetime() for uic in uic_operating_periods])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: min() iterable argument is empty

Execution time: 9 seconds

Script epip_db_to_db.py returned an error. Terminating the block of scripts: milano

Problem occurs during epip-to-eipi milano.gz

ue71603 commented 1 month ago

found an error. I test again.

ue71603 commented 1 month ago

error remains.

skinkie commented 1 month ago

So just starting at the top of the file. So we are receiving a PI_LINE_OFFER, with multiple lines, and the composite frame is called NETWORK_OFFER. That is a source data problem.

    <CompositeFrame id="epd:IT:CompositeFrame-EU_PI_NETWORK_OFFER:ita" version="1">
      <ValidBetween>
        <FromDate>2023-01-01T00:00:00</FromDate>
        <ToDate>2099-12-31T00:00:00</ToDate>
      </ValidBetween>
      <TypeOfFrameRef ref="epip:EU_PI_LINE_OFFER" />

But the actual problem can be found at: https://github.com/skinkie/reference/blob/master/gtfs-netex-test/transformers/epip.py#L452

In this case we are not creating the UicOperatingPeriods ourselves in the conversion, and we do not parse these objects from the ServiceCalendar (since they are embedded). Just committed a workaround. Need to fix this properly.